コード例 #1
0
 public async Task <JsonResult> QTInsert()
 {
     try {
         var id   = Guid.Parse(Request.Form["id"]);
         var qiid = Guid.Parse(Request.Form["qiid"]);
         var uid  = Guid.Parse(Request.Form["uid"]);
         var tp   = float.Parse(Request.Form["tp"]);
         var dtid = Guid.Parse(Request.Form["dtid"]);
         var aid  = Guid.Parse(Request.Form["aid"]);
         //check if user already in quizTaker then inform them
         if (QuizTakerService.GetByUQA(uid, qiid, aid) != null)
         {
             return(Failed(MessageUtilityService.AlreadyInRecord("owner of this quiz")));
         }
         if (QuizTakerService.Insert(id, qiid, uid, tp, dtid, aid))
         {
             return(Success(id.ToString()));
         }
         return(Failed(MessageUtilityService.FailedInsert("Takers")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }