public async Task <IDataResult <IList <TodoOutput> > > GetListByFilter(Expression <Func <Todo, bool> > filter = null) { var todos = await _todoDal.GetList(filter); var todoOutputs = MapsterTool.Map <IList <Todo>, IList <TodoOutput> >(todos); return(new SuccessDataResult <IList <TodoOutput> >(todoOutputs, Messages.Successfully)); }
public async Task <IDataResult <TodoOutput> > GetByFilter(Expression <Func <Todo, bool> > filter) { var todo = await _todoDal.Get(filter); var todoOutput = MapsterTool.Map <Todo, TodoOutput>(todo); return(new SuccessDataResult <TodoOutput>(todoOutput, Messages.Successfully)); }
public async Task <IDataResult <IList <AppUserOutput> > > GetListByFilter(Expression <Func <AppUser, bool> > filter = null) { var users = await _appUserDal.GetList(filter); var userOutputs = MapsterTool.Map <IList <AppUser>, IList <AppUserOutput> >(users); return(new SuccessDataResult <IList <AppUserOutput> >(userOutputs, Messages.Successfully)); }
public async Task <IDataResult <AppUserOutput> > GetByFilter(Expression <Func <AppUser, bool> > filter) { var user = await _appUserDal.Get(filter); var userOutput = MapsterTool.Map <AppUser, AppUserOutput>(user); return(new SuccessDataResult <AppUserOutput>(userOutput, Messages.Successfully)); }
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 async Task <IDataResult <TodoOutput> > Add(TodoAddInput addInput) { var todo = MapsterTool.Map <TodoAddInput, Todo>(addInput); todo.TodoItems.ToList().ForEach(t => t.Id = Guid.NewGuid()); await _todoDal.Add(todo); var todoOutput = MapsterTool.Map <Todo, TodoOutput>(todo); return(new SuccessDataResult <TodoOutput>(todoOutput, Messages.Successfully)); }
public async Task <IDataResult <AppUserOutput> > Add(AppUserRegisterInput registerInput) { var control = await BusinessRules.RunAsync(CheckUserEmail(registerInput.Email)); if (!control.Success) { return(new ErrorDataResult <AppUserOutput>(control.Message)); } var user = MapsterTool.Map <AppUserRegisterInput, AppUser>(registerInput); CreatePasswordHash(user, registerInput.Password); await _appUserDal.Add(user); var userOutput = MapsterTool.Map <AppUser, AppUserOutput>(user); return(new SuccessDataResult <AppUserOutput>(userOutput, Messages.Successfully)); }