public UserInformationsDto GetById(Guid id) { var user = _repository.GetLastByFilter <User>(x => x.Id == id); var userDto = new UserInformationsDto { Email = user.Email, FirstName = user.FirstName, LastName = user.LastName, Username = user.Username }; return(userDto); }
public IActionResult Register([FromBody] UserDto userDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = _userLogic.Create(userDto, userDto.Password); var userInformationDto = new UserInformationsDto { Email = user.Email, FirstName = user.FirstName, LastName = user.LastName, Username = user.Username }; return(Ok(userInformationDto)); }
IEnumerable <UserInformationsDto> IUserLogic.GetAll() { List <UserInformationsDto> usersDtos = new List <UserInformationsDto>(); var users = this._repository.GetAll <User>(); foreach (var user in users) { var userDto = new UserInformationsDto { Email = user.Email, FirstName = user.FirstName, LastName = user.LastName, Username = user.Username }; usersDtos.Add(userDto); } return(usersDtos); }