From 1994ffac77d3f64012684738032d1ff56da3b5a2 Mon Sep 17 00:00:00 2001 From: etudiant Date: Tue, 17 Jan 2023 17:22:13 +0100 Subject: [PATCH 1/6] Parti end poin2 --- Sources/BowlingApi/BowlingApi.csproj | 15 ++ .../Controllers/PartieController.cs | 133 ++++++++++++++++ Sources/BowlingApi/Program.cs | 2 + .../BowlingApi/Properties/launchSettings.json | 6 +- Sources/BowlingApi/bowling.db | Bin 45056 -> 45056 bytes Sources/BowlingApi/bowling.db-shm | Bin 32768 -> 0 bytes Sources/BowlingApi/bowling.db-wal | Bin 16512 -> 0 bytes Sources/BowlingEF/Entities/PartieEntity.cs | 2 +- .../Interface/IEquipeRepository.cs | 2 +- .../Interface/IpartieRepository.cs | 17 +++ .../Interface/PartieRepository.cs | 63 ++++++++ .../Interfaces/IPartieService.cs | 16 ++ .../Interfaces/PartieService.cs | 144 ++++++++++++++++++ Sources/BowlingService/JoueurService.cs | 2 +- Sources/DTOs/EquipeDTO.cs | 1 - Sources/DTOs/FrameDTO.cs | 7 +- Sources/DTOs/JoueurDTO.cs | 2 - Sources/DTOs/PartieDTO.cs | 8 +- Sources/Mapper/PartieProfile.cs | 2 +- .../BowlingAppUnitTest/BowlingAppUnitTest.sln | 25 +++ 20 files changed, 425 insertions(+), 22 deletions(-) create mode 100644 Sources/BowlingApi/Controllers/PartieController.cs delete mode 100644 Sources/BowlingApi/bowling.db-shm delete mode 100644 Sources/BowlingApi/bowling.db-wal create mode 100644 Sources/BowlingRepository/Interface/IpartieRepository.cs create mode 100644 Sources/BowlingRepository/Interface/PartieRepository.cs create mode 100644 Sources/BowlingService/Interfaces/IPartieService.cs create mode 100644 Sources/BowlingService/Interfaces/PartieService.cs create mode 100644 Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.sln diff --git a/Sources/BowlingApi/BowlingApi.csproj b/Sources/BowlingApi/BowlingApi.csproj index 64f00fb..7996562 100644 --- a/Sources/BowlingApi/BowlingApi.csproj +++ b/Sources/BowlingApi/BowlingApi.csproj @@ -7,9 +7,18 @@ 11 + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + @@ -18,6 +27,12 @@ + + + + + + PreserveNewest diff --git a/Sources/BowlingApi/Controllers/PartieController.cs b/Sources/BowlingApi/Controllers/PartieController.cs new file mode 100644 index 0000000..b2832f8 --- /dev/null +++ b/Sources/BowlingApi/Controllers/PartieController.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BowlingEF.Entities; +using BowlingLib.Model; +using BowlingService; +using BowlingService.Interfaces; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BowlingApi.Controllers +{ + + + [Route("api/[controller]")] + [ApiController] + public class PartieController : ControllerBase + { + + + private IpartieService _partieService; + + public PartieController(IpartieService partieService) + { + _partieService = partieService; + } + + + + + // GET: api/Partie + [HttpGet] + public async Task< IActionResult >Get() + { + try + { + var result = await _partieService.GetAll(); + if (result == null) + { + return NotFound(); + } + return Ok(result); + } + catch (Exception e) + { + return StatusCode(StatusCodes.Status500InternalServerError, e.Message); + throw; + } + //var result = _partieService.GetAll().Result; + //return Ok(result); + } + + // GET: api/Partie/djon + [HttpGet("{name}")] + public async Task < IActionResult> Get(string name) + { + // return Ok(_partieService.GetDataWithName(name)); + + + try + { + if (name == null) + return BadRequest("Le nom de la partie est obligatoire"); + + var result = _partieService.GetDataWithName(name).Result; + if (result == null) + { + return NotFound(); + } + return Ok(result); + } + catch (Exception e) + { + return StatusCode(StatusCodes.Status500InternalServerError, e.Message); + throw; + } + + } + + // POST: api/Partie + [HttpPost] + public async Task> Post([FromBody] PartieDTO parti) + { + + + try + { + if (parti == null) + { + return BadRequest("partie est obligatoire"); + } + var createdpartie = _partieService.Add(parti).Result; + return CreatedAtAction(nameof(Get), new { id = parti.Id }, createdpartie); + + } + catch (Exception e) + { + return StatusCode(StatusCodes.Status500InternalServerError, e.Message); + throw; + } + + } + + // PUT: api/Partie/5 + [HttpPut("{id}")] + public async Task> Put(string name, [FromBody] PartieDTO partie) + { + try + { + if (partie == null) + return BadRequest("La partie est obligatoire"); + + var updatepartie = _partieService.Update(partie); + if (updatepartie.Result == null) + { + return NotFound(); + } + + return Ok(updatepartie); + } + catch (Exception e) + { + StatusCode(StatusCodes.Status500InternalServerError, e.Message); + throw; + } + + } + + // DELETE: api/Partie/5 + + } +} diff --git a/Sources/BowlingApi/Program.cs b/Sources/BowlingApi/Program.cs index 2a009e5..fd44c1e 100644 --- a/Sources/BowlingApi/Program.cs +++ b/Sources/BowlingApi/Program.cs @@ -18,6 +18,8 @@ builder.Services.AddSwaggerGen(); builder.Services.AddAutoMapper(typeof(JoueurProfile)); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); var app = builder.Build(); diff --git a/Sources/BowlingApi/Properties/launchSettings.json b/Sources/BowlingApi/Properties/launchSettings.json index ea7e601..018693f 100644 --- a/Sources/BowlingApi/Properties/launchSettings.json +++ b/Sources/BowlingApi/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, @@ -11,7 +11,6 @@ "profiles": { "http": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "http://localhost:5229", @@ -21,7 +20,6 @@ }, "https": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "https://localhost:7097;http://localhost:5229", @@ -38,4 +36,4 @@ } } } -} +} \ No newline at end of file diff --git a/Sources/BowlingApi/bowling.db b/Sources/BowlingApi/bowling.db index b257dc97c3c1a54a3fd0845c3301fcc914f52b80..23c864c4697d73436bab4b92906bb8f3b0d1037e 100644 GIT binary patch delta 308 zcmW-aKTE?<6vc1S{Au5#9(AilTFop(v$?wH6p+%jL!nJtB@pt2O!gy)0oQ(kf{m05l2Y)#yg%dL=QLU z;tZ#_L)c$guAs)bMn!51&p&FnkkiPbC>G7w_e5N8{{eIqQV9S6 delta 150 zcmZp8z|`=7X~S)QMz+a!{FO!7co`TN*!Xuc@PFlh$$yvsBL7kTotp&(mhww*v9T~n zGK4vMhWH0@v4YrTnaL&jMUyYa8w;@UD>Lxl;or_bi9eU$gI^h_g`a=3a{faFpwwdq x{y+TR`9JZ$<$uBdc(b6wdH%_d=PLqb?tx^!@qgfd#s7r=9#G~K|Kxk?l>n0UG4=oe diff --git a/Sources/BowlingApi/bowling.db-shm b/Sources/BowlingApi/bowling.db-shm deleted file mode 100644 index 3f65a681d2476d70b2d43e929c9873a4e96c4434..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeI)y$M1w6b8^d{|aridmz{=2rgh_XJPLK7EYj3*tmm*GdP2_rQinknut7XEj8zZ z%MF(h$Qj_4*KtUx#VSJRHe&C@IYr_15$Fe|^jAD?<9z5Dpc zdt9|vJT+sb-maz&1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAn@A)Y1^F; z$Wx#Q^*lfB*8~UY5C-76?0s-|#!)OZ9M}qiB3jtk1;j)|5fexw1W6G@0+&S4Mi472MQm&Y z>tLTIomfV#M2&?a#KJ}qEhM-bP1GOY7rX;E?9T1N?o%Ff!z<=0^<8xlwULUOv+h#w zws*8;RGvLMdMHb#eB4I;e0;6HW53uMWzJT;XFba8d0?KmY;|fB*y_009U< z00Izz00bcLI|8nulShl`xm?B{bWEK>6c0ycCa2|bT0-wH9KBwTgk{|kpT>cYv90OU zNr_k@HYT?k>Nbt<0(5fPvl(A11-VLs%fw}V;0v_^0Rad=00Izz00bZa0SG_<0uX?} z9~W>n;c3xKK9%>gmLo(+8}*Y5sqBb6w`)%&{aiZb2IQKzVOI4DsHgc|ptf%B=(Bq@ z)h}T2?w5W6IYmGK0uX=z1Rwwb2tWV=5P$##AnOIJaO8EG{}D_q z&li^3HwIME;!ENee&Tz+<0@avDFOlzfB*y_009U<00Izz00bZafqx^Q3(_o=OqC3k Mbd`ik0U^kK1r2U;_W%F@ diff --git a/Sources/BowlingEF/Entities/PartieEntity.cs b/Sources/BowlingEF/Entities/PartieEntity.cs index 4929b51..4682cae 100644 --- a/Sources/BowlingEF/Entities/PartieEntity.cs +++ b/Sources/BowlingEF/Entities/PartieEntity.cs @@ -21,7 +21,7 @@ namespace BowlingEF.Entities [ForeignKey("JoueurForeignKey")] public JoueurEntity Joueur { get; set; } [Required] - public DateTime Date { get; set; } + public DateTime Date { get; set; } = DateTime.Now; public ICollection Frames { get; set; } [Required] public int? Score { get; set; } diff --git a/Sources/BowlingRepository/Interface/IEquipeRepository.cs b/Sources/BowlingRepository/Interface/IEquipeRepository.cs index c782472..c0d3ef9 100644 --- a/Sources/BowlingRepository/Interface/IEquipeRepository.cs +++ b/Sources/BowlingRepository/Interface/IEquipeRepository.cs @@ -1,4 +1,4 @@ -using BowlingEF.Entities; + using BowlingEF.Entities; namespace BowlingRepository.Interface; diff --git a/Sources/BowlingRepository/Interface/IpartieRepository.cs b/Sources/BowlingRepository/Interface/IpartieRepository.cs new file mode 100644 index 0000000..ea9c9be --- /dev/null +++ b/Sources/BowlingRepository/Interface/IpartieRepository.cs @@ -0,0 +1,17 @@ +using System; +using BowlingEF.Entities; + +namespace BowlingRepository.Interface +{ + public interface IpartieRepository + { + public Task Add(PartieEntity _partie); + public Task Delete(long id); + public Task Update(PartieEntity _partie); + public Task> GetAll(); + public Task> GetAllWithDate(DateTime date); + public Task GetDataWithName(string nom); + + } +} + diff --git a/Sources/BowlingRepository/Interface/PartieRepository.cs b/Sources/BowlingRepository/Interface/PartieRepository.cs new file mode 100644 index 0000000..df9a230 --- /dev/null +++ b/Sources/BowlingRepository/Interface/PartieRepository.cs @@ -0,0 +1,63 @@ +using System; +using BowlingEF.Context; +using BowlingEF.Entities; +using Microsoft.EntityFrameworkCore; + +namespace BowlingRepository.Interface +{ + public class PartieRepository:IpartieRepository + { + private readonly BowlingContext _context; + public PartieRepository() + { + _context = new BowlingContext(); + } + + public async Task Add(PartieEntity partie) + { + + var result = await _context.Parties.AddAsync(partie); + await _context.SaveChangesAsync(); + return result.Entity; + + //_context.Parties.Add( partie); + //return await _context.SaveChangesAsync() > 0; + + + } + + public async Task Delete(long id) + { + using (var context = new BowlingContext()) + { + PartieEntity entity = context.Parties.Find(id); + context.Parties.Remove(entity); + return await context.SaveChangesAsync() > 0; + } + } + + + + public async Task> GetAll() + { + return await _context.Parties.ToListAsync(); + } + + public Task> GetAllWithDate(DateTime date) + { + throw new NotImplementedException(); + } + + public Task GetDataWithName(string nom) + { + // return await _context.Parties.FirstOrDefaultAsync(n => n == nom); + throw new NotImplementedException(); + } + + public async Task Update(PartieEntity _partie) + { + return await _context.SaveChangesAsync() > 0; + } + } +} + diff --git a/Sources/BowlingService/Interfaces/IPartieService.cs b/Sources/BowlingService/Interfaces/IPartieService.cs new file mode 100644 index 0000000..c702fd6 --- /dev/null +++ b/Sources/BowlingService/Interfaces/IPartieService.cs @@ -0,0 +1,16 @@ +using System; +using BowlingEF.Entities; + +namespace BowlingService.Interfaces +{ + public interface IpartieService + { + public Task Add(PartieDTO _partie); + public Task Delete(PartieDTO _partie); + public Task Update(PartieDTO _partie); + public Task> GetAll(); + public Task> GetAllWithDate(DateTime date); + public Task GetDataWithName(string nom); + } +} + diff --git a/Sources/BowlingService/Interfaces/PartieService.cs b/Sources/BowlingService/Interfaces/PartieService.cs new file mode 100644 index 0000000..2d8afd0 --- /dev/null +++ b/Sources/BowlingService/Interfaces/PartieService.cs @@ -0,0 +1,144 @@ +using System; +using System.Xml.Linq; +using AutoMapper; +using BowlingEF.Context; +using BowlingEF.Entities; +using BowlingLib.Model; +using BowlingRepository; +using BowlingRepository.Interface; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + +namespace BowlingService.Interfaces +{ + public class PartieService:IpartieService + { + private readonly IpartieRepository _IpartieRepository; + private readonly ILogger _logger; + private readonly IMapper _mapper; + + public PartieService(IpartieRepository ipartieRepository, IMapper mapper, ILogger logger) + { + _IpartieRepository = ipartieRepository; + _mapper = mapper; + _logger = logger; + } + + public PartieService() + { + + } + + //Add + + public async Task Add(PartieDTO _partie) + { + bool result = false; + using (var context = new BowlingContext()) + { + PartieEntity entity = _mapper.Map(_partie); + context.Parties.Add(entity); + try + { + var data = await context.SaveChangesAsync(); + result = data == 1; + _logger.LogInformation("A new player was added : {player}", _partie.Id); + + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while adding new player : {player}", _partie.Id); + throw; + } + } + + return result; + } + //Delete + + public async Task Delete(PartieDTO _partie) + { + // return await _IpartieRepository.Delete(_partie.Id); + + var result = false; + try + { + result = await _IpartieRepository.Delete(_partie.Id); + _logger.LogInformation("la partie est supprimer", _partie.Id); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while deleting player : {player}", _partie.Id); + throw; + } + return result; + + } + + public async Task> GetAll() + { + List result = new List(); + using (var context = new BowlingContext()) + { + foreach (PartieEntity entity in await _IpartieRepository.GetAll()) + { + JoueurDTO joueur = _mapper.Map(entity.Joueur); + List frames = new List(); + foreach (FrameEntity frameEntity in entity.Frames) + { + FrameDTO frame = _mapper.Map(frameEntity); + frames.Add(frame); + } + result.Add(_mapper.Map(entity)); + } + } + return result.OrderBy(item => item.Date).ToList(); + + } + + public Task> GetAllWithDate(DateTime date) + { + throw new NotImplementedException(); + } + + public async Task GetDataWithName(string nom) + { + PartieDTO _partie = null; + + try + { + var partientity = await _IpartieRepository.GetDataWithName(nom); + _partie = _mapper.Map(partientity); + _logger.LogInformation("partie was retrieved : {partie}", nom); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while retrieving partie : {partie}", nom); + throw; + } + return _partie; + } + + + //Update + + public async Task Update(PartieDTO _partie) + { + + bool result = false; + using(var context =new BowlingContext()) + { + PartieEntity entity = _mapper.Map(_partie); + entity.Date = _partie.Date; + entity.Score = _partie.Score; + result = _IpartieRepository.Update(entity).Result; + + } + return result; + + } + + + } +} + diff --git a/Sources/BowlingService/JoueurService.cs b/Sources/BowlingService/JoueurService.cs index 20b57d6..72f4b1b 100644 --- a/Sources/BowlingService/JoueurService.cs +++ b/Sources/BowlingService/JoueurService.cs @@ -43,7 +43,7 @@ namespace BowlingService Pseudo = _joueur.Pseudo, }; - //Parcourt de la liste des parties d'un joueur + //Parcourt de la liste des parties d'un joueur DTA for (int i = 0; i < _joueur.PartieDTO.Count; i++) { //Mapping entre les parties d'un joueur et les partieEntity d'une partieEntity diff --git a/Sources/DTOs/EquipeDTO.cs b/Sources/DTOs/EquipeDTO.cs index 18d129e..55d8567 100644 --- a/Sources/DTOs/EquipeDTO.cs +++ b/Sources/DTOs/EquipeDTO.cs @@ -16,7 +16,6 @@ namespace BowlingEF.Entities public string Nom { get; set; } public ICollection Joueurs { get; set; } #endregion - #region Constructeurs public EquipeDTO() { diff --git a/Sources/DTOs/FrameDTO.cs b/Sources/DTOs/FrameDTO.cs index 377953a..c0ec75c 100644 --- a/Sources/DTOs/FrameDTO.cs +++ b/Sources/DTOs/FrameDTO.cs @@ -9,17 +9,12 @@ namespace BowlingEF.Entities public class FrameDTO { #region Properties - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public long Id { get; set; } - [Required] public int Numero { get; set; } - [Required] public int Lancer1 { get; set; } - [Required] public int Lancer2 { get; set; } public int Lancer3 { get; set; } - public PartieDTO Partie { get; set; } #endregion } diff --git a/Sources/DTOs/JoueurDTO.cs b/Sources/DTOs/JoueurDTO.cs index 8cf54ff..3df2f98 100644 --- a/Sources/DTOs/JoueurDTO.cs +++ b/Sources/DTOs/JoueurDTO.cs @@ -12,8 +12,6 @@ namespace BowlingEF.Entities [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } - - [Required] public string Pseudo { get; set; } public ICollection PartieDTO { get; set; } = new List(); #endregion diff --git a/Sources/DTOs/PartieDTO.cs b/Sources/DTOs/PartieDTO.cs index 0386481..ba8b942 100644 --- a/Sources/DTOs/PartieDTO.cs +++ b/Sources/DTOs/PartieDTO.cs @@ -14,16 +14,14 @@ namespace BowlingEF.Entities public class PartieDTO { #region Properties - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public long Id { get; set; } - [ForeignKey("JoueurForeignKey")] public JoueurDTO Joueur { get; set; } - [Required] + public DateTime Date { get; set; } public ICollection FramesDTO { get; set; } - [Required] + public int? Score { get; set; } #endregion diff --git a/Sources/Mapper/PartieProfile.cs b/Sources/Mapper/PartieProfile.cs index 8b4ffab..ab78a99 100644 --- a/Sources/Mapper/PartieProfile.cs +++ b/Sources/Mapper/PartieProfile.cs @@ -7,6 +7,6 @@ public class PartieProfile:Profile { public PartieProfile() { - CreateMap(); + CreateMap().ReverseMap(); } } \ No newline at end of file diff --git a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.sln b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.sln new file mode 100644 index 0000000..48ab595 --- /dev/null +++ b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 25.0.1704.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BowlingAppUnitTest", "BowlingAppUnitTest.csproj", "{6CE80C57-58B9-4481-B4EE-1DD615117D93}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6CE80C57-58B9-4481-B4EE-1DD615117D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CE80C57-58B9-4481-B4EE-1DD615117D93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CE80C57-58B9-4481-B4EE-1DD615117D93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CE80C57-58B9-4481-B4EE-1DD615117D93}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {977E7E9D-643B-4F31-B0F3-229032EB3B68} + EndGlobalSection +EndGlobal From 09b835ed78619c24050a1b6c718142fc11aefd3f Mon Sep 17 00:00:00 2001 From: etudiant Date: Sat, 28 Jan 2023 09:29:06 +0100 Subject: [PATCH 2/6] partiefin --- .../BowlingApi/Controllers/PartieController.cs | 1 - Sources/BowlingApi/bowling.db-shm | Bin 0 -> 32768 bytes Sources/BowlingApi/bowling.db-wal | Bin 0 -> 61832 bytes 3 files changed, 1 deletion(-) create mode 100644 Sources/BowlingApi/bowling.db-shm create mode 100644 Sources/BowlingApi/bowling.db-wal diff --git a/Sources/BowlingApi/Controllers/PartieController.cs b/Sources/BowlingApi/Controllers/PartieController.cs index b2832f8..f0630ab 100644 --- a/Sources/BowlingApi/Controllers/PartieController.cs +++ b/Sources/BowlingApi/Controllers/PartieController.cs @@ -127,7 +127,6 @@ namespace BowlingApi.Controllers } - // DELETE: api/Partie/5 } } diff --git a/Sources/BowlingApi/bowling.db-shm b/Sources/BowlingApi/bowling.db-shm new file mode 100644 index 0000000000000000000000000000000000000000..ee35ee0ac80c58e6ea779c54120faa25f844333b GIT binary patch literal 32768 zcmeI*yKMqN5C-7o{W=UGxntMi*aXDnBoI*mxkU>!L3$O?gq^zq0(%x&2oXVsxbK%n zds?klH(vp>ldrdw(}=32G#ru+gZ8%eE%+g*85daEIwX0hvRN?=lQtmlzi{+ zMgF(XODn$GQJtuMRQ`us_u{A!AV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ zz(WeuV%A)qFee16Cs25-s)8f)+eyB~7+&Lnwu8;CtBo znVj>7%zWnU&*s-W9(_h+PTnlUbwaNP=4XFB@b13Ek=IW>J|RZ;t1Wx^{#}1OH{YI^ z?@h|n!j#8_JT8BiCv*o30R#|0009ILKmY**5I_I{1ZrF$ZkTCf%TTGOG(3`UO|#zE zG~6}VGjfl*@3`}D*YIeuCmvBf|6Pv6)P7Vy)8f3~?dxBhZuxCyAgT5evQNlAE_O2_vp}YE^g~z_LqMN z+^8k$MQ2<4wuiR5uD%`{EfxERT&uj_-lq4>W!I6VYsa{BH|hcE^g}Gp1->_ejbHD4 zey5%b#8PL3JR#qcFUvu>SvJb3+F&7o00IagfB*srAbALcvTlKIpst(&C(ZCCWjPGTFe1jhpn!-Yu%Ql6%)_hY=Og7r(CcCmJ z=NJ5Z*3bDt&>X5JtK4K&HU)km%x7Cd-}9SWRg+n6GB0cL3Qa+_S^cfnmKN0%DK|wb zoBVvi_p@PZ5PEraPa6zdIBiQkVT0dX@ccrqDeDJ*OH-H^lj>Ev`gJbO1#Wn4;e+w} z4_(lk33*h=f8=?2PARo zjD#+6U0hupU1GY_=@Qk&*2U7r)Fon?!ch+p*FTGMfn;v_)eE0*Kdj< zwWXeI}>l-sq+Pr@}n!}4yq#-0tg_000IagfB*srAb1&T$Veiwpa)tfB*srAb1<)^ z8w*o9UmztPSs`~&9kLKW009ILKmY**5I_I{1Q0-=QouXiEoh{wWD7n;?qI&)``NHH2)%qx zOl~l2;j~2pF9?fKD4sUF+PzgVvK literal 0 HcmV?d00001 From 71912ebc8dbebbd61220ce4a38d512a6a1a84687 Mon Sep 17 00:00:00 2001 From: etudiant Date: Sat, 28 Jan 2023 10:19:42 +0100 Subject: [PATCH 3/6] Delete DB --- Sources/BowlingApi/bowling.db | Bin 45056 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Sources/BowlingApi/bowling.db diff --git a/Sources/BowlingApi/bowling.db b/Sources/BowlingApi/bowling.db deleted file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gEWNB{{S0VIF~kN^@u0!RP}AOR$R1a4OXd$oMzeclD&pZ~Kj{bND` zNB{{S0VIF~kN^@u0!RP}AOR$R1nyu07F;J9TqST7{sGtS;ErO~kN^@u0!RP}AOR$R z1dsp{Kmter3EVjZOhxNgyc-F@Gtli z{04pjFT=OtdH5`R9DdBQF(CmYfCP{L5iqIscm z@rlPFqLTsASZkhNt6XTVEuFK%I@w1aUpsfcd7)Zqnjs#1rn1EDT9`5eeB+~HBWVP6 z(nrqZ3v*L5hQa+>qglC7HFS|*$n$(n@~ZD6icX?rVSZu$6kq>`AV}aEd=owoD{u-1 z*d`_w6jK5ulJ{dW zwlkbdIJs0h?j)U&bS6ulwjzk*lc`|x%6GCT*LgQsAPy(6#)^H6{f zfCC3%7ip}TJKu#SZ`Uc zTR*YBW4&U%V12>*wDqKQ$tqh5)@f^uHH--fAOR$R1dsp{Kmter2_OL^a0?SKkB3ND zVJQ#@1dRv9Mwo2`jhy61B|jqhVaaDDpOJi8@+se&N#RAq0mJF+2p9>;KOp(I&XlHcchbFc8CVa?dn*`XQt zNxon5yCvTz`CXEaO8#ES@ASQSkMN>l)wsK}LpAP_{0_-)mpn+GO5T$EHp!ckH-uLr zY;r{+t$gMqVc&*)8}x0!x4LgN->SY Date: Sat, 28 Jan 2023 10:19:56 +0100 Subject: [PATCH 4/6] =?UTF-8?q?i=C3=A8tyi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/BowlingApi/BowlingApi.csproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Sources/BowlingApi/BowlingApi.csproj b/Sources/BowlingApi/BowlingApi.csproj index 7996562..f01ec54 100644 --- a/Sources/BowlingApi/BowlingApi.csproj +++ b/Sources/BowlingApi/BowlingApi.csproj @@ -33,10 +33,4 @@ - - - PreserveNewest - - - From 374a2ad8734c48ed5d90879731b8c7fa0ebb9e28 Mon Sep 17 00:00:00 2001 From: etudiant Date: Thu, 2 Feb 2023 11:15:52 +0100 Subject: [PATCH 5/6] mergemaain --- Sources/BowlingApi/BowlingApi.csproj | 4 ++++ .../Controllers/PartieController.cs | 1 + .../BowlingApi/Properties/launchSettings.json | 2 -- Sources/BowlingApi/bowling.db | Bin 0 -> 45056 bytes Sources/BowlingApi/bowling.db-shm | Bin 32768 -> 32768 bytes Sources/BowlingApi/bowling.db-wal | Bin 61832 -> 432632 bytes .../Interfaces/IPartieService.cs | 2 +- .../Interfaces/PartieService.cs | 12 +++++++----- 8 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 Sources/BowlingApi/bowling.db diff --git a/Sources/BowlingApi/BowlingApi.csproj b/Sources/BowlingApi/BowlingApi.csproj index f01ec54..dd139fa 100644 --- a/Sources/BowlingApi/BowlingApi.csproj +++ b/Sources/BowlingApi/BowlingApi.csproj @@ -9,6 +9,7 @@ + @@ -25,6 +26,9 @@ + + + diff --git a/Sources/BowlingApi/Controllers/PartieController.cs b/Sources/BowlingApi/Controllers/PartieController.cs index 4d9702f..c2fa25c 100644 --- a/Sources/BowlingApi/Controllers/PartieController.cs +++ b/Sources/BowlingApi/Controllers/PartieController.cs @@ -1,4 +1,5 @@ using System; +using DTOs; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/Sources/BowlingApi/Properties/launchSettings.json b/Sources/BowlingApi/Properties/launchSettings.json index fc48bb7..cfd4403 100644 --- a/Sources/BowlingApi/Properties/launchSettings.json +++ b/Sources/BowlingApi/Properties/launchSettings.json @@ -29,8 +29,6 @@ }, "RestFull": { "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, "applicationUrl": "https://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/Sources/BowlingApi/bowling.db b/Sources/BowlingApi/bowling.db new file mode 100644 index 0000000000000000000000000000000000000000..67440ac9b463d80b9dfbf795241192ae40928c02 GIT binary patch literal 45056 zcmeI4OKcm*8OLY2d@jB7*-0E)R_v@PzZhE#cli<-6^=@;VpcMx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mg_@Fn)G zfS2J#_zb)Nn{WlX(1Zr8!qe~+JPC7P!x_jy5+>mU9D#Az4*(%h>3`|F^l$Xf^pEr{ zdV~Iw{*3;V{(yd$euI9MzRDWLganWP5>>jELjit2SN3fJrd}^sRpsgt@BjY~3z;{w literal 0 HcmV?d00001 diff --git a/Sources/BowlingApi/bowling.db-shm b/Sources/BowlingApi/bowling.db-shm index ee35ee0ac80c58e6ea779c54120faa25f844333b..8a04399ba9224be89210f76cc03f77c5b93d7952 100644 GIT binary patch delta 425 zcmb7;$ua|B6h=?~gf=EQ4v2BC z8}C9D0%??Z%jI4|dYz*9+4Viv2u`)5RGw?u|%nTe1 ayg=qx4ptThP6j@RC@TXO13!={C=UR2&o*oT diff --git a/Sources/BowlingApi/bowling.db-wal b/Sources/BowlingApi/bowling.db-wal index 17279a8f40a6fe0715ac3a7930fa60e5d5e20748..b0a20a8d3ef19032263deb1595881b8d1b4e64fd 100644 GIT binary patch literal 432632 zcmeI*dw3M(y}}LO}#CKq}rq zIY196s2q*dTWeKpt(RH^rFbfG5Uo}ziV7BK1@%$X;uW5H>v`X?l3mUaWkWu2#FFLemN~HRI;G^5SCXvD@C8f8k#$r;d<^T#3h5e*2Ms z-h1~^H9qmS<`5e-u~B?1wy6~i0tg_000IagfB*srAbaoh6Pu^c zaC;n%K-Q4y1TJfB*srAbqmK^zV@QpWolm_SLAA9n|MSl71P8pQ6vAzAbJ`pwS^?5vZVdqh5I_I{1Q0*~0R#|0009K{3Ah|t zS?*l*nvv6GxgU-x8QS}8pVxdKMP#$CuKmY**5I_I{ z1Q0*~0R#|0pkoExo_#IAban@GkBQ!YvhmifYF{AF|L%U>L3w~d009ILKmY**5I_I{ z1Q0-=dkO^eWUDWn<*{lD(jA=Z%8QGk$4>iO;j3@{=h!0E7x0LU7TrO4kU;>Yicc{5k-3*?Cx_UjJH0}KKPAbu)E#{GS95RJ`@PrZslI?$%(mHoAlA#{!bNgN{3&edXIH+}N!80{LRb0lI_o z1cLwq2q1s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O&Oqdk*%)ZWKYd0bqZsAEs0s60 z`RSO%kXYX-Alo_l&R_&1-{yr6H}i!{bArQ)7h708qf#i_8(g2exnrHi_JktjQ2zV- z!>NwH&EcCn9$w(*<>ds0GPbbJ<*R*t*WuId?Gq+3{^y@QpOKN%1m;UsX+5i;m2c;R ze96Zjh$oEs12+ch@=s^o#HdJlDC@xNS4sA|`!Hf}Fvxx`z73e6e1>ns#=t3jOj2Ca yZ4WX^Mx@Xqz#o~VT8FCVtl56!5ORP|U`Yt-E7%{l&4}?7zc3#cD8SK!T^Rt~y;PV0 diff --git a/Sources/BowlingService/Interfaces/IPartieService.cs b/Sources/BowlingService/Interfaces/IPartieService.cs index 593fd75..662e67f 100644 --- a/Sources/BowlingService/Interfaces/IPartieService.cs +++ b/Sources/BowlingService/Interfaces/IPartieService.cs @@ -6,7 +6,7 @@ namespace BowlingService.Interfaces { public interface IpartieService { - public Task Add(PartieDTO _partie); + public Task Add(PartieDTO _partie); public Task Delete(PartieDTO _partie); public Task Update(PartieDTO _partie); public Task> GetAll(); diff --git a/Sources/BowlingService/Interfaces/PartieService.cs b/Sources/BowlingService/Interfaces/PartieService.cs index 29e2c04..52539ae 100644 --- a/Sources/BowlingService/Interfaces/PartieService.cs +++ b/Sources/BowlingService/Interfaces/PartieService.cs @@ -32,17 +32,19 @@ namespace BowlingService.Interfaces //Add - public async Task Add(PartieDTO _partie) + +public async Task Add(PartieDTO _partie) { - bool result = false; + + PartieDTO result = null; using (var context = new BowlingContext()) { PartieEntity entity = _mapper.Map(_partie); - context.Parties.Add(entity); + //context.Parties.Add(entity); try { - var data = await context.SaveChangesAsync(); - result = data == 1; + //var data = await context.SaveChangesAsync(); + result =_mapper.Map(await _IpartieRepository.Add(entity)); _logger.LogInformation("A new player was added : {player}", _partie.Id); } From 76e6e09f261f6e6794f1a52d8f963c1f788d074c Mon Sep 17 00:00:00 2001 From: etudiant Date: Thu, 2 Feb 2023 11:16:03 +0100 Subject: [PATCH 6/6] dd --- .../Controllers/PartieController.cs | 8 ++++---- Sources/BowlingApi/bowling.db | Bin 45056 -> 45056 bytes Sources/BowlingApi/bowling.db-shm | Bin 32768 -> 0 bytes Sources/BowlingApi/bowling.db-wal | Bin 432632 -> 0 bytes .../Interface/IpartieRepository.cs | 2 +- .../Interface/PartieRepository.cs | 7 ++++--- Sources/BowlingRepository/JoueurRepository.cs | 2 +- .../Interfaces/IPartieService.cs | 2 +- .../Interfaces/PartieService.cs | 10 +++++----- 9 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 Sources/BowlingApi/bowling.db-shm delete mode 100644 Sources/BowlingApi/bowling.db-wal diff --git a/Sources/BowlingApi/Controllers/PartieController.cs b/Sources/BowlingApi/Controllers/PartieController.cs index c2fa25c..cd67275 100644 --- a/Sources/BowlingApi/Controllers/PartieController.cs +++ b/Sources/BowlingApi/Controllers/PartieController.cs @@ -53,18 +53,18 @@ namespace BowlingApi.Controllers } // GET: api/Partie/djon - [HttpGet("{name}")] - public async Task Get(string name) + [HttpGet("{id}")] + public async Task Get(int id) { // return Ok(_partieService.GetDataWithName(name)); try { - if (name == null) + if (id == null) return BadRequest("Le nom de la partie est obligatoire"); - var result = _partieService.GetDataWithName(name).Result; + var result = _partieService.GetDataWithId(id).Result; if (result == null) { return NotFound(); diff --git a/Sources/BowlingApi/bowling.db b/Sources/BowlingApi/bowling.db index 67440ac9b463d80b9dfbf795241192ae40928c02..e0616d7fb245ceb32cbf0d1219f7218e0e9f3120 100644 GIT binary patch delta 1470 zcmZwHO-K}B9LMoz*In0{o#*-O?EB2lE|!po5Y`Pmgoi*vI|-73MigWzniz!;366&@ zb%W;S)g_|&KiJM59#}s6gRi@@&$`Uia&T%n zc+S39((@r^u^rnwws-gFPR-8MY`bP#H9JdtXmEIB zd`!>O?6m(kA{Aom=>3O>2FK|d$q;k@Ur6gxD=QM6-zUZ~Qr*Yh-{jwHPw5qBUoQ5mP#$H#g;;a36D+!ENteaRrxg3FlG9N$-Af3@(mh z90xJt{gj*GhU!?LK;#LB$PqSS5m_Qbq=^)fBoaiNFo_reLJ*uVh$x{G8qq*Ri26`n zd8J~vJLspA{K9vv;DdLLS9pdec;ubp9`4`9(&LZtBX=TW4n#`ogbdpRZ$Yh*Mm}ERgnjm9>1Sf?-@+fKOWK<*d OhA=&8k@C{b_5T2pB?Kq{ delta 133 zcmWm5p$fu49Khkf3*(CXHn7-+7kv@i9>HW3Ut!JeJ;1$yps*l|28+#jIFE@26$BB~ zV(`o#U(rNG6D{|7OPM;?-MB3x3M;(0a$v`t3d^QUlPSgyM@ftpYF5k`Ge8G{QcsRq jN8yAoAD-N~aKhsPuQAT{L-c=r^WerAU#8g>;}^Xj#$hl6 diff --git a/Sources/BowlingApi/bowling.db-shm b/Sources/BowlingApi/bowling.db-shm deleted file mode 100644 index 8a04399ba9224be89210f76cc03f77c5b93d7952..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeI*$x;(h6oBDBNC1fpDng>nh!X}84MKtgGboOrf*NH|(S>Wvg&X#k8{dMra?Lxy z?Nk3gPZXJuDQN#%9p`=(wtjxw9Vzdpn~H5qrBuh^ zkM9S+|72sXk7`E|)jj$rDwE+dULB;vy&+^{$mWnyKh7n~Ap8Ej|-8RZs}++~&} zR(Z}V-m=A~m~~yQK=K9Z!Y+%aI87%P=x3N~+~77-++&Vq9`l0Nykncs$^R5PR3N6n z37Tl(3|(|Hz$Hc)qd<}S%(KE1*4UuT4tp`{x?BMT6i`3`1r$i0Ks_gE;he1!@#XhjRtm=paWgLtG&r&K|hKG&3ynh-bXy4IlVe yIjNw=SNXUC3Mim}0tzUgfC36Apnw7jD4>7>3Mim}0tzUgfC36ApnwAZS>PB%3^_mm diff --git a/Sources/BowlingApi/bowling.db-wal b/Sources/BowlingApi/bowling.db-wal deleted file mode 100644 index b0a20a8d3ef19032263deb1595881b8d1b4e64fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432632 zcmeI*dw3M(y}}LO}#CK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qDw)-N8!vv68xj--;}nnfv{U@2I{&FaN#m?heXJ83YhO009ILKmY** z5I_I{1UgW_(<`AhNO#baV{$YNA2niR2X+S^duj7y&0h}QqxJ z)4PLrEc>517ms%AP{Xe$-NF9@N_yxO diff --git a/Sources/BowlingRepository/Interface/IpartieRepository.cs b/Sources/BowlingRepository/Interface/IpartieRepository.cs index ea9c9be..a1d2df6 100644 --- a/Sources/BowlingRepository/Interface/IpartieRepository.cs +++ b/Sources/BowlingRepository/Interface/IpartieRepository.cs @@ -10,7 +10,7 @@ namespace BowlingRepository.Interface public Task Update(PartieEntity _partie); public Task> GetAll(); public Task> GetAllWithDate(DateTime date); - public Task GetDataWithName(string nom); + public Task GetDataWithId(int id); } } diff --git a/Sources/BowlingRepository/Interface/PartieRepository.cs b/Sources/BowlingRepository/Interface/PartieRepository.cs index 817ec0a..9cd4a1d 100644 --- a/Sources/BowlingRepository/Interface/PartieRepository.cs +++ b/Sources/BowlingRepository/Interface/PartieRepository.cs @@ -48,12 +48,13 @@ namespace BowlingRepository.Interface throw new NotImplementedException(); } - public Task GetDataWithName(string nom) + public async Task GetDataWithId(int id) { - // return await _context.Parties.FirstOrDefaultAsync(n => n == nom); - throw new NotImplementedException(); + var data = await _context.Parties.FirstOrDefaultAsync(n => n.Id == id); + return data; } + public async Task Update(PartieEntity _partie) { return await _context.SaveChangesAsync() > 0; diff --git a/Sources/BowlingRepository/JoueurRepository.cs b/Sources/BowlingRepository/JoueurRepository.cs index 3e0a513..7bedefe 100644 --- a/Sources/BowlingRepository/JoueurRepository.cs +++ b/Sources/BowlingRepository/JoueurRepository.cs @@ -30,7 +30,7 @@ public class JoueurRepository:IJoueurRepository public async Task Update(JoueurEntity joueur) { - return await _context.SaveChangesAsync() > 0; + return await _context.SaveChangesAsync() > 0; } public async Task GetJoueur(long id) diff --git a/Sources/BowlingService/Interfaces/IPartieService.cs b/Sources/BowlingService/Interfaces/IPartieService.cs index 662e67f..29e47ab 100644 --- a/Sources/BowlingService/Interfaces/IPartieService.cs +++ b/Sources/BowlingService/Interfaces/IPartieService.cs @@ -11,7 +11,7 @@ namespace BowlingService.Interfaces public Task Update(PartieDTO _partie); public Task> GetAll(); public Task> GetAllWithDate(DateTime date); - public Task GetDataWithName(string nom); + public Task GetDataWithId(int id); } } diff --git a/Sources/BowlingService/Interfaces/PartieService.cs b/Sources/BowlingService/Interfaces/PartieService.cs index 52539ae..9ba6d33 100644 --- a/Sources/BowlingService/Interfaces/PartieService.cs +++ b/Sources/BowlingService/Interfaces/PartieService.cs @@ -104,19 +104,19 @@ public async Task Add(PartieDTO _partie) throw new NotImplementedException(); } - public async Task GetDataWithName(string nom) + public async Task GetDataWithId(int id) { PartieDTO _partie = null; try { - var partientity = await _IpartieRepository.GetDataWithName(nom); + var partientity = await _IpartieRepository.GetDataWithId(id); _partie = _mapper.Map(partientity); - _logger.LogInformation("partie was retrieved : {partie}", nom); + _logger.LogInformation("partie was retrieved : {partie}", id); } catch (Exception ex) { - _logger.LogError(ex, "Error while retrieving partie : {partie}", nom); + _logger.LogError(ex, "Error while retrieving partie : {partie}", id); throw; } return _partie; @@ -141,7 +141,7 @@ public async Task Add(PartieDTO _partie) } - + } }