Beispiel #1
0
 public ActionResult CommentEditPartial(MCommentEdit mCommentEdit)
 {
     if (DataBase.Security.IsMCommentOwner(mCommentEdit.id, Request.Cookies["access_token"].Value))
     {
         if (ModelState.IsValid)
         {
             if (DataBase.Missions.commentedit(mCommentEdit))
             {
                 ModelState.Add("status", new ModelState { Value = new ValueProviderResult("success", "Коментарий изменён", null) });
             }
             else
             {
                 ModelState.Add("status", new ModelState { Value = new ValueProviderResult("success", "произошла ошибка", null) });
             }
         }
     }
     else
     {
         ModelState.Add("status", new ModelState { Value = new ValueProviderResult("success", "разве вы владелец этого коментария? пфф", null) });
     }
     var missioniew = new MissionView(DataBase.Missions.GetById(mCommentEdit.mid));
     return View("~/Views/Mission/Partial/CommentOperationResult.cshtml", missioniew);
 }
Beispiel #2
0
 public ActionResult Edit(int id)
 {
     var at = Request.Cookies["access_token"].Value;
     if (DataBase.Security.IsMissionOwner(id, at))
     {
         MissionView miss = new MissionView(DataBase.Missions.GetById(id));
         return View("Edit", miss);
     }
     return View();
 }
Beispiel #3
0
        public ActionResult GetById(int id)
        {
            var miss = DataBase.Missions.GetById((int)id);
            DataBase.Missions.ShowUp(id);
            if (miss != null)
            {
                var missionView = new MissionView(miss);
                string at;
                if (Request.Cookies["access_token"] != null)
                {
                    at = Request.Cookies["access_token"].Value;

                    missionView.IsOwner = DataBase.Security.IsMissionOwner(id, at);

                    missionView.IsAgent = DataBase.Security.IsAgent(at);

                }
                return View("Page", missionView);
            }
            return View();
        }
Beispiel #4
0
 public ActionResult CommentPartial(int mid)
 {
     var missioniew = new MissionView(DataBase.Missions.GetById(mid));
     return PartialView("~/Views/Mission/Partial/Comments.cshtml", missioniew);
 }