public ActionResult ShowProfile(int id)
        {
            var vm = GetServiceUserBranch();

            ServiceUser serviceUser = vm.FirstOrDefault(s => s.serviceUser.Id == id).serviceUser;
            Branch      branch      = vm.FirstOrDefault(b => b.serviceUser.BranchId == serviceUser.BranchId).branch;

            var menu = _menuRepo.GetAll().ToList();

            var viewModel = new ServiceUserProfile();

            if (serviceUser != null)
            {
                viewModel.serviceUser = serviceUser;
                viewModel.branch      = branch;
                viewModel.UserMenu    = menu;
                //viewModel.UserMenuDescription = userMenuDescr;

                Session["userId"] = serviceUser.Id;
            }
            else
            {
                return(new HttpNotFoundResult("Not Found"));
            }

            return(View("Profile", viewModel));
        }
Beispiel #2
0
 public static UserShortModel ToUserShortModel(this ServiceUserProfile profile)
 {
     return(new UserShortModel()
     {
         ID = profile.ID,
         Name = string.IsNullOrEmpty(profile.Name) ? "Anonym" : profile.Name,
         Surname = string.IsNullOrEmpty(profile.Surname) ? "Anonymus" : profile.Surname,
         PhotoPath = profile.PhotoPath
     });
 }
Beispiel #3
0
 public static _UserProfileModel To_UserProfileModel(this ServiceUserProfile profile)
 {
     return(new _UserProfileModel()
     {
         ID = profile.ID,
         Name = profile.Name,
         Surname = profile.Surname,
         PhotoPath = profile.PhotoPath,
     });
 }
Beispiel #4
0
 public static DalUserProfile ToDalUserProfile(this ServiceUserProfile profile)
 {
     return(new DalUserProfile
     {
         ID = profile.ID,
         Name = profile.Name,
         Surname = profile.Surname,
         Male = profile.Male,
         PhotoPath = profile.PhotoPath,
         BirthDate = profile.BirthDate,
         Level = profile.Level,
         Points = profile.Points
     });
 }
Beispiel #5
0
 public static UserProfileModel ToUserProfileModel(this ServiceUserProfile profile)
 {
     return(new UserProfileModel()
     {
         ID = profile.ID,
         BirthDate = profile.BirthDate,
         Level = profile.Level,
         Male = profile.Male,
         Name = profile.Name,
         Surname = profile.Surname,
         PhotoPath = profile.PhotoPath,
         Points = profile.Points
     });
 }
Beispiel #6
0
 public void UpdateUserProfile(ServiceUserProfile profile)
 {
     unit.Users.UpdateUserProfile(profile.ToDalUserProfile());
     unit.Save();
 }