Esempio n. 1
0
        public async Task <LoginUser> Login(UserRequestDto userRequestDto)
        {
            var result = await _userRespository.GetAllListAsync(u => u.Name == userRequestDto.Name &&
                                                                u.Password == userRequestDto.Password);

            var user = result.SingleOrDefault();

            if (user == null)
            {
                return(await Task.FromResult <LoginUser>(null));
            }
            return(await Task.FromResult(new LoginUser()
            {
                Id = user.Id, UserId = user.Id, Name = user.Name, RoleId = user.RoleId,
                PhoneCode = user.PhoneCode
            }));
        }