partief
continuous-integration/drone/push Build is failing Details

pull/6/head
etudiant 2 years ago
commit ec54013a14

@ -1,21 +1,21 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using BowlingEF.Entities; using BowlingEF.Entities;
using BowlingLib.Model; using BowlingLib.Model;
using BowlingService; using BowlingService;
using BowlingService.Interfaces; using BowlingService.Interfaces;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace BowlingApi.Controllers namespace BowlingApi.Controllers
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]
public class PartieController : ControllerBase public class PartieController : ControllerBase
{ {
@ -31,7 +31,7 @@ namespace BowlingApi.Controllers
// GET: api/Partie // GET: api/Partie
[HttpGet] [HttpGet]
public async Task< IActionResult >Get() public async Task<IActionResult> Get()
{ {
try try
{ {
@ -47,13 +47,13 @@ namespace BowlingApi.Controllers
return StatusCode(StatusCodes.Status500InternalServerError, e.Message); return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
throw; throw;
} }
//var result = _partieService.GetAll().Result; //var result = _partieService.GetAll().Result;
//return Ok(result); //return Ok(result);
} }
// GET: api/Partie/djon // GET: api/Partie/djon
[HttpGet("{name}")] [HttpGet("{name}")]
public async Task < IActionResult> Get(string name) public async Task<IActionResult> Get(string name)
{ {
// return Ok(_partieService.GetDataWithName(name)); // return Ok(_partieService.GetDataWithName(name));
@ -76,11 +76,11 @@ namespace BowlingApi.Controllers
throw; throw;
} }
} }
// POST: api/Partie // POST: api/Partie
[HttpPost] [HttpPost]
public async Task<ActionResult<PartieDTO>> Post([FromBody] PartieDTO parti) public async Task<ActionResult<PartieDTO>> Post([FromBody] PartieDTO parti)
{ {
@ -99,12 +99,12 @@ namespace BowlingApi.Controllers
return StatusCode(StatusCodes.Status500InternalServerError, e.Message); return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
throw; throw;
} }
} }
// PUT: api/Partie/5 // PUT: api/Partie/5
[HttpPut("{id}")] [HttpPut("{id}")]
public async Task<ActionResult<PartieDTO>> Put(string name, [FromBody] PartieDTO partie) public async Task<ActionResult<PartieDTO>> Put(string name, [FromBody] PartieDTO partie)
{ {
try try
{ {
@ -124,9 +124,10 @@ namespace BowlingApi.Controllers
StatusCode(StatusCodes.Status500InternalServerError, e.Message); StatusCode(StatusCodes.Status500InternalServerError, e.Message);
throw; throw;
} }
} }
} }
} }

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
namespace BowlingRepository.Interface namespace BowlingRepository.Interface
{ {
public class PartieRepository:IpartieRepository public class PartieRepository : IpartieRepository
{ {
private readonly BowlingContext _context; private readonly BowlingContext _context;
public PartieRepository() public PartieRepository()
@ -36,7 +36,7 @@ namespace BowlingRepository.Interface
} }
} }
public async Task<List<PartieEntity>> GetAll() public async Task<List<PartieEntity>> GetAll()
{ {
@ -61,3 +61,4 @@ namespace BowlingRepository.Interface
} }
} }

@ -3,7 +3,7 @@ using BowlingEF.Entities;
namespace BowlingService.Interfaces namespace BowlingService.Interfaces
{ {
public interface IpartieService public interface IpartieService
{ {
public Task<bool> Add(PartieDTO _partie); public Task<bool> Add(PartieDTO _partie);
public Task<bool> Delete(PartieDTO _partie); public Task<bool> Delete(PartieDTO _partie);

@ -11,8 +11,8 @@ using Microsoft.Extensions.Logging;
namespace BowlingService.Interfaces namespace BowlingService.Interfaces
{ {
public class PartieService:IpartieService public class PartieService : IpartieService
{ {
private readonly IpartieRepository _IpartieRepository; private readonly IpartieRepository _IpartieRepository;
private readonly ILogger<JoueurService> _logger; private readonly ILogger<JoueurService> _logger;
private readonly IMapper _mapper; private readonly IMapper _mapper;
@ -25,9 +25,9 @@ namespace BowlingService.Interfaces
} }
public PartieService() public PartieService()
{ {
} }
//Add //Add
@ -101,9 +101,9 @@ namespace BowlingService.Interfaces
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task<PartieDTO> GetDataWithName(string nom) public async Task<PartieDTO> GetDataWithName(string nom)
{ {
PartieDTO _partie = null; PartieDTO _partie = null;
try try
{ {
@ -126,19 +126,20 @@ namespace BowlingService.Interfaces
{ {
bool result = false; bool result = false;
using(var context =new BowlingContext()) using (var context = new BowlingContext())
{ {
PartieEntity entity = _mapper.Map<PartieEntity>(_partie); PartieEntity entity = _mapper.Map<PartieEntity>(_partie);
entity.Date = _partie.Date; entity.Date = _partie.Date;
entity.Score = _partie.Score; entity.Score = _partie.Score;
result = _IpartieRepository.Update(entity).Result; result = _IpartieRepository.Update(entity).Result;
} }
return result; return result;
} }
} }
} }

Loading…
Cancel
Save