Example #1
0
 public ActionResult Cancel(string target, int type, string returnurl)
 {
     if (type <= 0 || type >= 7)
     {
         return(RedirectToAction("NotFound", "Error"));
     }
     else
     {
         if (type == 1 || type == 2 || type == 3)
         {
             if (!MovieManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else if (type == 4)
         {
             if (!CelebManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else if (type == 5)
         {
             if (!ResManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else if (type == 6)
         {
             if (!AskManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else
         {
             if (!AlbumManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
     }
     if (User.Identity.Name != null)
     {
         MarkManager.Cancel(target, AccountManager.GetId(User.Identity.Name), type);
     }
     return(Redirect(returnurl));
 }
 public ActionResult Create(string target, int type, string returnurl)
 {
     if (type <= 0 || type >= 7)
     {
         return(RedirectToAction("NotFound", "Error"));
     }
     else
     {
         if (type == 1 || type == 2 || type == 3)
         {
             if (!MovieManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else if (type == 4)
         {
             if (!CelebManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else if (type == 5)
         {
             if (!ResManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else if (type == 6)
         {
             if (!AskManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
         else
         {
             if (!AlbumManager.Exist(target))
             {
                 return(RedirectToAction("NotFound", "Error"));
             }
         }
     }
     if (CookieHepler.GetCookie("user") != null)
     {
         MarkManager.Create(target, AccountManager.GetId(CookieHepler.GetCookie("user")), type);
     }
     return(Redirect(returnurl));
 }
        public ActionResult Over(string id, string returnUrl)
        {
            if (!AskManager.Exist(id))
            {
                return(RedirectToAction("NotFound", "Error"));
            }
            string user = AccountManager.GetId(CookieHepler.GetCookie("user"));

            if (_db.tbl_Mark.SingleOrDefault(w => w.mark_Target == id && w.mark_User == user && w.mark_Type == 6) == null)
            {
                AskManager.Over(id);
            }
            return(RedirectToLocal(returnUrl));
        }
 public ActionResult Create(ManageAskViewModel model)
 {
     if (!string.IsNullOrEmpty(model.Note) && !string.IsNullOrWhiteSpace(model.Note))
     {
         var user = _db.tbl_UserAccount.SingleOrDefault(u => u.user_Account == CookieHepler.GetCookie("user"));
         model.User = user.user_Id;
         AskManager.Create(model);
         return(RedirectToAction("Index", "Movie", new { id = model.MovieId }));
     }
     else
     {
         ModelState.AddModelError("", "备注 不能为空,请重新输入 备注。");
         return(View(model));
     }
 }
        public ActionResult Delete(string id, string returnurl)
        {
            if (!AskManager.Exist(id))
            {
                return(RedirectToAction("NotFound", "Error"));
            }

            var user  = _db.tbl_UserAccount.SingleOrDefault(m => m.user_Account == CookieHepler.GetCookie("user")).user_Id;
            var favor = _db.tbl_Ask.SingleOrDefault(m => m.ask_Id == id && m.ask_User == user);

            if (favor != null)
            {
                AskManager.Delete(id);
            }
            return(Redirect(returnurl));
        }