public ActionResult ExamTypeGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Qiyas.BusinessLogicLayer.Entity.PPM.ExamType item) { if (ModelState.IsValid) { try { if (!ExamTypeExists(item.Name, item.ExaminationTypeID)) { BusinessLogicLayer.Entity.PPM.ExamType type = new BusinessLogicLayer.Entity.PPM.ExamType(item.ExaminationTypeID); type.Name = item.Name; type.IsActive = item.IsActive; type.ModifiedDate = DateTime.Now; type.Save(); } else { ViewData["EditError"] = Resources.MainResource.ExamTypeExists; } // Insert here a code to update the item in your model } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = Resources.MainResource.PleaseCorrectErrors; } var model = new BusinessLogicLayer.Components.PPM.ExamTypeLogic().GetAll(); return(PartialView("_ExamTypeGridViewPartial", model)); }
public Qiyas.BusinessLogicLayer.Entity.PPM.ExamType GetByName(string name) { Qiyas.BusinessLogicLayer.Entity.PPM.ExamType examType = null; var ex = db.ExamTypes.Where(c => c.Name == name).FirstOrDefault(); if (ex != null) { examType = new Entity.PPM.ExamType(ex); } return(examType); }