Example #1
0
 public ActionResult Create(Player player)
 {
     if (ModelState.IsValid)
     {
         var dao = new PlayerDao();
         if (dao.CheckIdentification(player.Identification) == false)
         {
             long id = dao.Insert(player);
             if (id > 0)
             {
                 SetAlert("Create a new player successfully.", "success");
                 return(RedirectToAction("Index", "player"));
             }
             else
             {
                 ModelState.AddModelError("", "Create a new player failed.");
             }
         }
         else
         {
             ModelState.AddModelError("", "The Identification already exists. Please try another Identification.");
         }
     }
     return(View(player));
 }