//Converts User DB model to assigned user dto model public static UserAssignedDTO ConvertToAssignedUserDTO(User user) { UserAssignedDTO userDto = new UserAssignedDTO(); userDto.FirstName = user.FirstName; userDto.LastName = user.LastName; userDto.isAdmin = user.ProjectUsers.Where(x => x.UserId == user.Id).FirstOrDefault().isAdmin; userDto.Id = user.Id; userDto.Avatar = user.Avatar; return userDto; }
public static User ConvertToUser(RegisterDTO dto) { User user = new User(); user.Email = dto.Email; user.LastName = dto.LastName; user.FirstName = dto.FirstName; user.Username = dto.Username; user.Password = dto.Password; user.Avatar = String.Format("{0}_{1}", user.Username, dto.File.FileName); return user; }