public JsonResult Post(string credit, int year, int term)
 {
     if (credit == null)
     {
         return(ResponceModel.GetInstanceInvalid());
     }
     else
     {
         return(Course.GetCourse(credit, year, term));
     }
 }
 public JsonResult Post(string method, string credit, int?id, int?subid, string time, string content, string pic)
 {
     if (credit == null)
     {
         return(ResponceModel.GetInstanceInvalid());
     }
     else
     {
         return(MsgBoard.Control(method, credit, id, subid, time, content, pic));
     }
 }
Пример #3
0
 public static ResponceModel Control(string method, string credit, int?id, int?subid, string time, string content, string pic)
 {
     try
     {
         if (credit == null)
         {
             return(ResponceModel.GetInstanceInvalid());
         }
         else if (credit == "")
         {
             return(new ResponceModel(403, "凭证为空"));
         }
         else
         {
             if (UserCredit.CheckUser(credit, out string username))
             {
                 if (method == "add")
                 {
                     if (content == null)
                     {
                         return(ResponceModel.GetInstanceInvalid());
                     }
                     else
                     {
                         return(Add(username, content, pic));
                     }
                 }
                 else if (method == "update")
                 {
                     if (time == null)
                     {
                         return(ResponceModel.GetInstanceInvalid());
                     }
                     else
                     {
                         return(Update(time));
                     }
                 }
                 else if (method == "addcomment")
                 {
                     if (id == null || content == null)
                     {
                         return(ResponceModel.GetInstanceInvalid());
                     }
                     else
                     {
                         return(AddComment(username, id.Value, content));
                     }
                 }
                 else if (method == "change")
                 {
                     if (id == null || content == null)
                     {
                         return(ResponceModel.GetInstanceInvalid());
                     }
                     else
                     {
                         return(Change(username, id.Value, content, pic));
                     }
                 }
                 else if (method == "delete")
                 {
                     if (id == null)
                     {
                         return(ResponceModel.GetInstanceInvalid());
                     }
                     else
                     {
                         return(Delete(username, id.Value));
                     }
                 }
                 else if (method == "deletecomment")
                 {
                     if (id == null || subid == null)
                     {
                         return(ResponceModel.GetInstanceInvalid());
                     }
                     else
                     {
                         return(DeleteCommnet(username, (int)id, (int)subid));
                     }
                 }
                 else
                 {
                     return(ResponceModel.GetInstanceInvalid());
                 }
             }
             else
             {
                 return(new ResponceModel(403, "无效的凭证"));
             }
         }
     }
     catch (Exception ex)
     {
         return(ResponceModel.GetInstanceError(ex));
     }
 }