Exemple #1
0
 public ActionResult Create(Widget newWidget)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _case.CreateWidget(newWidget.Name, newWidget.Price);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newWidget));
         }
     }
     catch
     {
         return(View(newWidget));
     }
 }
Exemple #2
0
 public ActionResult Create(Widget newWidget)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _case.CreateWidget(newWidget.Name, newWidget.Price, newWidget.User.Id);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newWidget));
         }
     }
     catch (Exception e)
     {
         Log.Error(e.Message);
         return(View(newWidget));
     }
 }