示例#1
0
 public ActionResult AddNameSubmit(CandidateModel cm)
 {
     try
     {
         cm.BidCount  = 0;
         cm.Hidden    = 1;
         cm.Priority  = 0;
         cm.BidAdjust = 0;
         CandidateRepository cr = new CandidateRepository();
         int duplicateId        = cr.CheckDuplicate(cm);
         if (duplicateId == -2)
         {
             return(Json(new { success = false, message = "提名失败,被提名对象已经存在。如果在投票页面上没有见到,可能处于审核状态。" }));
         }
         if (duplicateId != -1)
         {
             cm.Type = cm.Type + 10 * duplicateId;
         }
         cr.Insert(cm);
         cr.Save();
         return(Json(new { success = true }));
     }
     catch (Exception e)
     {
         return(Json(new { success = false, message = e.Message }));
     }
 }