public async Task <BaseResponse <Dietician> > Handle(DeleteDieticianCommand request, CancellationToken cancellationToken) { var response = new BaseResponse <Dietician> () { ReponseName = nameof(DeleteDieticianCommand), Content = new List <Dietician> () { } }; var entity = await _dieticianRepository.GetOneAsync(p => p.Id == request.Id); if (entity == null) { response.Status = ResponseType.Warning; response.Message = $"{nameof(Dietician)} not found."; response.Content = null; } else { await _dieticianRepository.DeleteAsync(entity); response.Status = ResponseType.Success; response.Message = $"{nameof(Dietician)} deleted successfully."; response.Content.Add(entity); } return(response); }
public async Task <BaseResponse <Dietician> > Handle(GetLoginQuery request, CancellationToken cancellationToken) { var response = new BaseResponse <Dietician> () { ReponseName = nameof(GetLoginQuery), Content = new List <Dietician> () { } }; var entity = await _dieticianRepository.GetOneAsync(p => (p.Username == request.username) && (p.Password == request.password)); entity = _mapper.Map <Dietician> (entity); if (entity == null) { response.Status = ResponseType.Warning; response.Message = $"{nameof(Dietician)} not found."; response.Content = null; } else { response.Status = ResponseType.Success; response.Message = $"{nameof(Dietician)} get successfully."; response.Content.Add(entity); } return(response); }