diff --git a/Sources/BowlingApi/Controllers/PartieController.cs b/Sources/BowlingApi/Controllers/PartieController.cs index f0630ab..4d9702f 100644 --- a/Sources/BowlingApi/Controllers/PartieController.cs +++ b/Sources/BowlingApi/Controllers/PartieController.cs @@ -1,21 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +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 +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BowlingApi.Controllers { - - - [Route("api/[controller]")] - [ApiController] - public class PartieController : ControllerBase + + + [Route("api/[controller]")] + [ApiController] + public class PartieController : ControllerBase { @@ -31,7 +31,7 @@ namespace BowlingApi.Controllers // GET: api/Partie [HttpGet] - public async Task< IActionResult >Get() + public async Task Get() { try { @@ -47,13 +47,13 @@ namespace BowlingApi.Controllers return StatusCode(StatusCodes.Status500InternalServerError, e.Message); throw; } - //var result = _partieService.GetAll().Result; + //var result = _partieService.GetAll().Result; //return Ok(result); } // GET: api/Partie/djon [HttpGet("{name}")] - public async Task < IActionResult> Get(string name) + public async Task Get(string name) { // return Ok(_partieService.GetDataWithName(name)); @@ -76,11 +76,11 @@ namespace BowlingApi.Controllers throw; } - } - - // POST: api/Partie - [HttpPost] - public async Task> Post([FromBody] PartieDTO parti) + } + + // POST: api/Partie + [HttpPost] + public async Task> Post([FromBody] PartieDTO parti) { @@ -99,12 +99,12 @@ namespace BowlingApi.Controllers return StatusCode(StatusCodes.Status500InternalServerError, e.Message); throw; } - - } - - // PUT: api/Partie/5 - [HttpPut("{id}")] - public async Task> Put(string name, [FromBody] PartieDTO partie) + + } + + // PUT: api/Partie/5 + [HttpPut("{id}")] + public async Task> Put(string name, [FromBody] PartieDTO partie) { try { @@ -124,9 +124,10 @@ namespace BowlingApi.Controllers StatusCode(StatusCodes.Status500InternalServerError, e.Message); throw; } - - } - - - } -} + + } + + + } +} + diff --git a/Sources/BowlingRepository/Interface/PartieRepository.cs b/Sources/BowlingRepository/Interface/PartieRepository.cs index df9a230..817ec0a 100644 --- a/Sources/BowlingRepository/Interface/PartieRepository.cs +++ b/Sources/BowlingRepository/Interface/PartieRepository.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore; namespace BowlingRepository.Interface { - public class PartieRepository:IpartieRepository + public class PartieRepository : IpartieRepository { private readonly BowlingContext _context; public PartieRepository() @@ -36,7 +36,7 @@ namespace BowlingRepository.Interface } } - + public async Task> GetAll() { @@ -61,3 +61,4 @@ namespace BowlingRepository.Interface } } + diff --git a/Sources/BowlingService/Interfaces/IPartieService.cs b/Sources/BowlingService/Interfaces/IPartieService.cs index c702fd6..0175995 100644 --- a/Sources/BowlingService/Interfaces/IPartieService.cs +++ b/Sources/BowlingService/Interfaces/IPartieService.cs @@ -3,7 +3,7 @@ using BowlingEF.Entities; namespace BowlingService.Interfaces { - public interface IpartieService + public interface IpartieService { public Task Add(PartieDTO _partie); public Task Delete(PartieDTO _partie); diff --git a/Sources/BowlingService/Interfaces/PartieService.cs b/Sources/BowlingService/Interfaces/PartieService.cs index 2d8afd0..cfc2006 100644 --- a/Sources/BowlingService/Interfaces/PartieService.cs +++ b/Sources/BowlingService/Interfaces/PartieService.cs @@ -11,8 +11,8 @@ using Microsoft.Extensions.Logging; namespace BowlingService.Interfaces { - public class PartieService:IpartieService - { + public class PartieService : IpartieService + { private readonly IpartieRepository _IpartieRepository; private readonly ILogger _logger; private readonly IMapper _mapper; @@ -25,9 +25,9 @@ namespace BowlingService.Interfaces } public PartieService() - { + { - } + } //Add @@ -101,9 +101,9 @@ namespace BowlingService.Interfaces throw new NotImplementedException(); } - public async Task GetDataWithName(string nom) + public async Task GetDataWithName(string nom) { - PartieDTO _partie = null; + PartieDTO _partie = null; try { @@ -126,19 +126,20 @@ namespace BowlingService.Interfaces { bool result = false; - using(var context =new BowlingContext()) + using (var context = new BowlingContext()) { PartieEntity entity = _mapper.Map(_partie); entity.Date = _partie.Date; entity.Score = _partie.Score; - result = _IpartieRepository.Update(entity).Result; + result = _IpartieRepository.Update(entity).Result; } return result; } - + } } +