// PUT api/values/5 public HttpResponseMessage Put(int id, tblSchools schoolDetails) { try { var school = unitOfWork.SchoolRepository.GetByID(id); school.SchoolID = schoolDetails.SchoolID; school.SchoolName = schoolDetails.SchoolName; school.SchoolAddress = schoolDetails.SchoolAddress; school.City = schoolDetails.City; school.Country = schoolDetails.Country; unitOfWork.SchoolRepository.Update(school); unitOfWork.Save(); return(Request.CreateResponse <tblSchools>(HttpStatusCode.OK, school)); } catch { return(Request.CreateResponse <tblSchools>(HttpStatusCode.NotFound, null)); } }
public void DeleteSchool(int tblSchoolsid) { tblSchools tblSchools = context.tblSchools.Find(tblSchoolsid); context.tblSchools.Remove(tblSchools); }
public void UpdateSchool(tblSchools tblSchools) { context.Entry(tblSchools).State = System.Data.Entity.EntityState.Modified; }
public void InsertSchool(tblSchools school) { context.tblSchools.Add(school); }