public SaveTODOResponse Update(UpdateTODO request) { var ret = new SaveTODOResponse(); var item = GetActualForUser(request.UserId) .SingleOrDefault(x => x.PublicId == request.PublicId); if (item == null) { ret.SetError($"Item with id {request.PublicId} not found"); } else { item.Title = request.Title; item.Description = request.Description; item.Updated = DateTime.UtcNow; try { _dbContext.SaveChanges(); item = GetActualForUser(request.UserId) .SingleOrDefault(x => x.PublicId == request.PublicId); } catch (Exception e) { ret.SetError(e.Message); return(ret); } ret.Data = _mapper.Map <TodoPublicEntity>(item); } return(ret); }
public SaveTODOResponse Update([FromBody] UpdateTODO request) { return(_todoService.Update(request)); }