public bool Complete(int id) { var entity = _todoDal.Get(td => td.Id == id); if (entity != null) { entity.IsCompleted = true; _todoDal.Update(entity); return(true); } return(false); }
public HttpResponseMessage UpdateTodo([FromBody] TodoDTO todo) { if (todo == null) { var exception = new Exception("Requested todo object is empty"); logger.Log(LogLevel.Error, exception); return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception)); } _todoDal.Update(todo); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <IResult> Update(TodoUpdateInput updateInput) { var todo = await _todoDal.Get(t => t.Id == updateInput.Id); todo.TodoItems.ToList().Where(t => t.Id == null).ToList().ForEach(t => t.Id = Guid.NewGuid()); todo.TodoItems = MapsterTool.Map <IList <TodoItemUpdateInput>, IList <TodoItem> >(updateInput.TodoItems); await _todoDal.Update(todo); return(new SuccessResult(Messages.Successfully)); }
public void Update(Todo entity) { _todoDal.Update(entity); }
public IResult Update(Todo todo) { _todoDal.Update(todo); return(new SuccessResult(Messages.TodoUpdate)); }