public ActionResult Create(Monitoring model) { //check existed var q = this.monitoringService.Find(c => c.MonitoringName == model.MonitoringName); if (q != null) { ModelState.AddModelError("MonitoringName", "Monitoring Name existed"); } if (ModelState.IsValid) { model.CreateUser = this.LoginUser.UserName; model.CreateTime = DateTime.Now; this.monitoringService.Add(model); return RedirectToAction("List"); } return View(); }
public ActionResult Edit(Monitoring model) { var oldTypename = Request.QueryString["oldTypeName"].ToString(); var qCheck = this.monitoringService.Find(c => c.MonitoringName == model.MonitoringName); if (qCheck != null && qCheck.MonitoringName!=oldTypename) { ModelState.AddModelError("MonitoringName", "Monitoring name existed"); } if (ModelState.IsValid) { var q = this.monitoringService.Find(c => c.MonitoringID == model.MonitoringID); q.MonitoringName = model.MonitoringName; q.IsActive = model.IsActive; q.UpdateTime = DateTime.Now; q.UpdateUser = this.LoginUser.UserName; this.monitoringService.Update(q); return RedirectToAction("List"); } return View(); }
public bool Update(Monitoring model) { return this.monitoringDal.Update(model); }
public bool Add(Monitoring model) { return this.monitoringDal.Add(model); }