public bool addRaza(SCPMdbModel.SCPM_RAZAS newx) { var contains = db.SCPM_RAZAS.ToList().Any(u => u.RAZ_NOM.Equals(newx.RAZ_NOM, StringComparison.InvariantCultureIgnoreCase)); if (contains || newx.RAZ_NOM == "") { return(false); } db.AddToSCPM_RAZAS(newx); db.SaveChanges(); return(true); }
public bool editRaza(SCPM_RAZAS newx) { var contains = db.SCPM_RAZAS.ToList().Any(u => u.RAZ_NOM.Equals(newx.RAZ_NOM, StringComparison.InvariantCultureIgnoreCase) && u.RAZ_ID != newx.RAZ_ID); if (contains || newx.RAZ_NOM == "") return false; var _a = from a in db.SCPM_RAZAS where a.RAZ_ID == newx.RAZ_ID select a; if (_a.Count() < 1) return false; var area = _a.First(); area.RAZ_NOM = newx.RAZ_NOM; area.RAZ_EST = newx.RAZ_EST; db.SaveChanges(); return true; }