// Delete SchoolVersion public SchoolVersion DeleteSchoolVersion(int id) { SchoolVersion sv = _context.SchoolVersion.Find(id); if (sv != null) { _context.SchoolVersion.Remove(sv); _context.SaveChanges(); return(sv); } return(null); }
// Save And Update ************** public SchoolVersion SaveSchoolVersion(SchoolVersion schoolVersion) { if (schoolVersion.Id == 0) { _context.SchoolVersion.Add(schoolVersion); _context.SaveChanges(); return(schoolVersion); } else { SchoolVersion schv = _context.SchoolVersion.Find(schoolVersion.Id); if (schv != null) { schv.SchoolVersionName = schoolVersion.SchoolVersionName; _context.SchoolVersion.Update(schv); _context.SaveChanges(); return(schv); } } return(null); }