Пример #1
0
 public ActionResult Create(TodoViewModel model)
 {
     if (!Request.IsAjaxRequest())
     {
         if (!ModelState.IsValid)
         {
             return View("New", model);
         }
         var todo = new Todo { WhatToDo = model.Todo, WhenToDoIt = model.When == null ? DateTime.Now : model.When.Value };
         _repository.Create(todo);
         TempData["message"] = "New Item Added";
         return RedirectToAction("Index");
     }
     return Json(new { message = "Success" });
 }
Пример #2
0
 public ActionResult New(string description, int? value)
 {
     //throw new Exception();
     var model = new TodoViewModel { EMail = "*****@*****.**", When = DateTime.Now };
     return View(model);
 }