public async Task <ActionResult <GetMemberViewModel> > GetByEmail(GetMemberByEmailCommand command) { var member = await _memberService.GetMemberByEmail(command); var memberViewModel = _mapper.Map <GetMemberViewModel>(member); return(Ok(memberViewModel)); }
public Task <Member> GetMemberByEmail(GetMemberByEmailCommand command) { if (command == null) { throw new CustomBadRequestException(ExceptionMessage.NullCommand); } if (!IsEmailValid(command.Email)) { throw new CustomBadRequestException(ExceptionMessage.BadEmailFormat); } return(_context.Members .Include(m => m.IdentityCards) .Include(m => m.Blacklists) .Include(m => m.MemberCards) .SingleOrDefaultAsync(m => m.Email == command.Email)); }