public int ControllerGroup(RolePrivilageModel modelTosave) { ControllerGroups datamodel = new ControllerGroups { ControllerGroupName = modelTosave.GroupId.ToString(), SeqNumber = modelTosave.SeqNumber, ProductId = modelTosave.ProductId }; ent.AddToControllerGroups(datamodel); ent.SaveChanges(); return(datamodel.ControllerGroupId); }
// for checking duplicate insertion of GroupName public bool CheckDuplicateGroupName(string GroupName) { ControllerGroups result = ent.ControllerGroups.Where(x => x.ControllerGroupName == GroupName).FirstOrDefault(); if (result != null) { return(false); } else { return(true); } }