示例#1
0
        public ActionResult DeclineRequest(int senderID)
        {
            try
            {
                var user = Session["User"] as ProfileModel;

                var _userID = _userRepository.GetUser(User.Identity.Name).UserAccountID;
                //Repositoryt tar bort requesten.
                _friendshipRepository.DeleteRequest(senderID, _userID);

                //Uppdaterar antalet obesvarade requests
                user.RequestCount = _friendshipRepository.RequestCount(user.UserAccountID);
                Session["User"]   = user;

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View("Error", new ErrorModel {
                    Exception = e
                }));
            }
        }