示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
 public IDataResult <Todo> GetById(int id)
 {
     return(new SuccessDataResult <Todo>(_todoDal.Get(x => x.ID == id)));
 }