public EditUserDetailViewModel GetEditUserDetail() { var editUserDetail = new EditUserDetailViewModel(); var user = _userService.GetUser(); var userDetail = _userDetailRepository.GetAll(x => x.UserId == user.UserId).Include("Nationality").Include("DrivingLicense").FirstOrDefault(); if (userDetail != null) { editUserDetail.ProfileImage = userDetail.ProfileImage; editUserDetail.UserName = user.UserName; editUserDetail.NameSurname = userDetail.NameSurname; editUserDetail.BirthDate = userDetail.BirthDate; editUserDetail.Gender = userDetail.Gender; editUserDetail.DrivingLicenseName = userDetail.DrivingLicense.DrivingLicenseType; editUserDetail.NationalityName = userDetail.Nationality.NationalityName; editUserDetail.NationalityId = userDetail.NationalityId; editUserDetail.DrivingLicenseId = userDetail.DrivingLicenseId; editUserDetail.numberOfUnreadMessages = _messageService.GetUnreadMessageCount(); editUserDetail.ProfileImageFileName = Path.GetFileName(userDetail.ProfileImage); } editUserDetail.DrivingLicenseList = _drivingLicenseService.GetDrivingLicenseList(); editUserDetail.NationalityList = _nationalityService.GetNationalityList(); return(editUserDetail); }
public List <int> GetUserIdListByGender(GenderEnum gender) { var foundedUsers = _userDetailRepository.GetAll(x => x.Gender == gender).ToList(); var userIdList = new List <int>(); if (foundedUsers != null) { foreach (var item in foundedUsers) { userIdList.Add(item.UserId); } } return(userIdList); }
public List <UserDetailView> GetUserDetailViewList() { var list = new List <UserDetailView>(); var request = _userDetailRepository.GetAll(); foreach (var item in request) { var model = new UserDetailView(); Mapper.Map(item, model); list.Add(model); } return(list); }