public HttpResponseMessage DeleteTodo(int id) { if (id == 0) { var exception = new Exception("Please provide a valid todo"); logger.Log(LogLevel.Error, exception); return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception)); } _todoDal.Delete(id); return(Request.CreateResponse(HttpStatusCode.OK)); }
public bool Delete(int id) { var entity = _todoDal.Get(td => td.Id == id); if (entity != null) { _todoDal.Delete(entity); return(true); } return(false); }
public async Task <IResult> Delete(Guid id) { var todo = await _todoDal.Get(t => t.Id == id); if (todo == null) { return(new ErrorResult(Messages.UnSuccessfully)); } await _todoDal.Delete(todo); return(new SuccessResult(Messages.Successfully)); }
public IResult Delete(Todo todo) { _todoDal.Delete(todo); return(new SuccessResult(Messages.TodoDeleted)); }