public ActionResult Add(DSRCManagementSystem.Models.Category objmodel) { DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1(); DSRCManagementSystem.Category obj = new DSRCManagementSystem.Category(); try { obj.CategoryName = objmodel.CategoryName.Trim(); obj.IsActive = true; objdb.AddToCategories(obj); if (!objdb.Categories.Any(cobj => cobj.IsActive == true && cobj.CategoryName.Trim() == obj.CategoryName.Trim())) { objdb.SaveChanges(); } else { return(Json(new { Result = "Already", URL = @Url.Action("AlertPopUp", "Popup") }, JsonRequestBehavior.AllowGet)); } } catch (Exception Ex) { string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName); } return(Json(new { Result = "Success", URL = @Url.Action("AlertPopUp", "Popup") }, JsonRequestBehavior.AllowGet)); }