Exemplo n.º 1
0
 public ActionResult Reply(ReplyNew rn)
 {
     var at = Request.Cookies["access_token"].Value;
     if (DataBase.Security.CanReply(rn.mid, at))
     {
         rn.owner = DataBase.Security.GetOwner(at);
         DataBase.Missions.reply(rn);
         return RedirectToAction("GetById", new { id = rn.mid });
     }
     return RedirectToAction("GetById", new { id = rn.mid });
 }
Exemplo n.º 2
0
 public static bool reply(ReplyNew rn)
 {
     var miss = context.mission.FirstOrDefault(q => q.ID == rn.mid);
     if (miss != null && (miss.status == "new" || miss.status == "opened"))
     {
         var r = new replies()
         {
             mid = rn.mid,
             body = rn.body,
             owner = rn.owner,
             date = Time.UNIXNow()
         };
         try
         {
             context.replies.InsertOnSubmit(r);
             Save();
             return true;
         }
         catch
         {
             return false;
         }
     }
     return false;
 }