Пример #1
0
 public ActionResult AddNewSchool(School model)
 {
     ViewBag.AlreadyExists = false;
     if (ModelState.IsValid)
     {
         if (model.Id != 0)
         {
             bool IsUpdated = School.Update(model.Id, model.Name);
             if (IsUpdated)
             {
                 return(RedirectToAction("Index"));
             }
         }
         else
         {
             bool isAdded = School.AddNew(model.Name, ApplicationHelper.LoggedUserId);
             if (isAdded)
             {
                 return(RedirectToAction("Index"));
             }
         }
         ViewBag.AlreadyExists = true;
         return(View(model));
     }
     else
     {
         return(View(model));
     }
 }