public bool editProfesion(SCPM_PROFESIONES newx) { var contains = db.SCPM_PROFESIONES.ToList().Any(u => u.PROF_NOM.Equals(newx.PROF_NOM, StringComparison.InvariantCultureIgnoreCase) && u.PROF_ID != newx.PROF_ID); if (contains || newx.PROF_NOM == "") return false; var _a = from a in db.SCPM_PROFESIONES where a.PROF_ID == newx.PROF_ID select a; if (_a.Count() < 1) return false; var area = _a.First(); area.PROF_NOM = newx.PROF_NOM; area.PROF_EST = newx.PROF_EST; db.SaveChanges(); return true; }
public bool addProfesion(SCPM_PROFESIONES newx) { var contains = db.SCPM_PROFESIONES.ToList().Any(u => u.PROF_NOM.Equals(newx.PROF_NOM, StringComparison.InvariantCultureIgnoreCase)); if (contains || newx.PROF_NOM == "") return false; db.AddToSCPM_PROFESIONES(newx); db.SaveChanges(); return true; }