public async Task <IActionResult> Update(ReasonDTO reasonDto, int id) { var reason = _mapper.Map <Reason>(reasonDto); await _reasonService.Update(reason, id); return(Ok()); }
public IActionResult GetById(int id) { //Reason testThis = _repository.GetById<Reason>(id); var item = ReasonDTO.FromReason(_repository.GetById <Reason>(id)); return(Ok(item)); }
public IActionResult Put(int id, [FromBody] string value) { var reason = _repository.GetById <Reason>(id); reason.Description = value; reason.LastChangedBy = "Some User"; reason.LastChangedDateTime = DateTime.Now; _repository.Update(reason); return(Ok(ReasonDTO.FromReason(reason))); }
public IActionResult Post([FromBody] ReasonDTO item) { var newReason = new Reason() { Description = item.Description, LastChangedBy = "Some User", LastChangedDateTime = DateTime.Now }; _repository.Add(newReason); return(Ok(ReasonDTO.FromReason(newReason))); }
public static Reason Convert(this ReasonDTO reasonDto) { return(new Reason { ItemId = reasonDto.ItemId, IsDeleted = reasonDto.IsDeleted, Updated = reasonDto.Updated, CorrectorId = reasonDto.CorrectorId, FullName = reasonDto.Name, Category = reasonDto.Category }); }
public async Task Add(ReasonDTO reasonDto) { var reason = _mapper.Map <Reason>(reasonDto); await _reasonService.Create(reason); }