public async Task <IActionResult> PutWashRequest(long id, WashRequestDto washRequest) { if (id != washRequest.Id) { return(BadRequest()); } try { _washRequestService.Update(id, washRequest); } catch (DbUpdateConcurrencyException) { if (!WashRequestExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public WashRequestDto Update(long id, WashRequestDto item) { if (string.IsNullOrEmpty(item.WashRequestRef)) { throw new AppException("La référence est obligatoire"); } return(_washRequestRepository.Update(id, item)); }
public async Task <ActionResult <WashRequestDto> > PostWashRequest(WashRequestDto washRequest) { washRequest.WashRequestRef = Helper.GenerateRef(); try { _washRequestService.Insert(washRequest); return(Ok()); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public WashRequestDto Insert(WashRequestDto item) { return(_washRequestRepository.Insert(item)); }