Ejemplo n.º 1
0
        public ActionResult Profile(string user)
        {
            if (Session[SessionKey.UserId] == null)
            {
                return(new HttpNotFoundResult());
            }
            var usr = UserDAO.GetUserFromUsername(user);

            if (usr == null)
            {
                return(new HttpNotFoundResult());
            }

            var vm = ProfileVM.ModelToVm(usr);

            if (Session[SessionKey.UserId] != null && Equals(Session[SessionKey.UserId], usr.Id))
            {
                vm.IsOwner = true;
            }
            else if (Session[SessionKey.UserId] != null && usr.Friends.Any(f => f.Id == (Guid)Session[SessionKey.UserId]))
            {
                vm.IsFriend = true;
            }
            return(View(vm));
        }
Ejemplo n.º 2
0
        public ActionResult Profile(ProfileVM vm)
        {
            if (Session[SessionKey.UserId] == null)
            {
                return(new HttpNotFoundResult());
            }
            vm.Id = (Guid)Session[SessionKey.UserId];
            UserDAO.UpdateUser(vm);

            var resultvm = ProfileVM.ModelToVm(UserDAO.GetUser(vm.Id));

            resultvm.IsOwner = true;
            return(View(resultvm));
        }