public ActionResult GenericAttribute_Add([Bind(Exclude = "Id")] GenericAttribute model, string locator) { try { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = "error" })); } //var genericAttribute = new GenericAttribute(); //if (locator == "location") //{ // genericAttribute = _genericAttributeService.GetAllLocation().FirstOrDefault(c => c.EntityValue == model.EntityValue); //} //else if(locator == "speciality") //{ // genericAttribute = _genericAttributeService.GetAllSpecialities().FirstOrDefault(c => c.EntityValue == model.EntityValue); //} //if (genericAttribute.Id == 0) //{ model.EntityKey = locator; _genericAttributeService.Insert(model); //} return(new NullJsonResult()); } catch (Exception ex) { return(new NullJsonResult()); } }