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.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<IActionResult> 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<IActionResult> Get(string name)
{
// return Ok(_partieService.GetDataWithName(name));
@ -76,11 +76,11 @@ namespace BowlingApi.Controllers
throw;
}
}
// POST: api/Partie
[HttpPost]
public async Task<ActionResult<PartieDTO>> Post([FromBody] PartieDTO parti)
}
// POST: api/Partie
[HttpPost]
public async Task<ActionResult<PartieDTO>> 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<ActionResult<PartieDTO>> Put(string name, [FromBody] PartieDTO partie)
}
// PUT: api/Partie/5
[HttpPut("{id}")]
public async Task<ActionResult<PartieDTO>> Put(string name, [FromBody] PartieDTO partie)
{
try
{
@ -124,9 +124,10 @@ namespace BowlingApi.Controllers
StatusCode(StatusCodes.Status500InternalServerError, e.Message);
throw;
}
}
}
}
}
}
}

@ -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<List<PartieEntity>> GetAll()
{
@ -61,3 +61,4 @@ namespace BowlingRepository.Interface
}
}

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

@ -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<JoueurService> _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<PartieDTO> GetDataWithName(string nom)
public async Task<PartieDTO> 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<PartieEntity>(_partie);
entity.Date = _partie.Date;
entity.Score = _partie.Score;
result = _IpartieRepository.Update(entity).Result;
result = _IpartieRepository.Update(entity).Result;
}
return result;
}
}
}

Loading…
Cancel
Save