public ActionResult Create(Service service)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (service._NextStartTime < DateTime.Now)
                 service._NextStartTime = DateTime.Now;
             db.Services.InsertOnSubmit(service);
             db.SubmitChanges();
             if (Request.IsAjaxRequest())
                 return Content(null);
             return RedirectToAction("Index");
         }
     }
     catch (Exception e)
     {
         var g = ((System.Data.Entity.Validation.DbEntityValidationException)e).EntityValidationErrors;
     }
     if (Request.IsAjaxRequest())
         return PartialView(service);
     return View(service);
 }
 public ActionResult Edit(Service service)
 {
     if (ModelState.IsValid)
     {
         Service s = db.Services.Where(r => r.Id == service.Id).First();
         //s.Id = service.Id;
         s.AdminEmails = service.AdminEmails;
         s.Command = service.Command;
         s.Comment = service.Comment;
         s.RunTimeout = service.RunTimeout;
         s.RunTimeSpan = service.RunTimeSpan;
         s.RestartDelayIfBroken = service.RestartDelayIfBroken;
         s.ExeFolder = service.ExeFolder;
         s.State = service.State;
         db.SubmitChanges();
         if (Request.IsAjaxRequest())
             return Content(null);
         return RedirectToAction("Index");
     }
     ViewBag.State = new SelectList(StateSelect, "Value", "Name", service.State);
     ViewBag.Command = new SelectList(CommandSelect, "Value", "Name", service.Command);
     if (Request.IsAjaxRequest())
         return PartialView(service);
     return View(service);
 }
 partial void UpdateService(Service instance);
 partial void DeleteService(Service instance);
 partial void InsertService(Service instance);