public string SaveTestCenter(Testcenter objTestCenter) { string status = string.Empty; using (var dbContext = new mimsContext()) { dbContext.Testcenter.Add(objTestCenter); dbContext.SaveChanges(); } return("Success"); }
public string DeactivateTestCenterById(int id) { string status = string.Empty; using (var dbContext = new mimsContext()) { Testcenter _objTestCenter = dbContext.Testcenter.Where(obj => obj.Id == id).Select(obj => obj).FirstOrDefault(); _objTestCenter.Updatedon = DateTime.Now; _objTestCenter.Active = new System.Collections.BitArray(1, false); dbContext.SaveChanges(); } return("Success"); }
public string UpdateTestCenter(Testcenter objTestCenter) { string status = string.Empty; using (var dbContext = new mimsContext()) { var _objTestCenter = dbContext.Testcenter.SingleOrDefault(b => b.Id == objTestCenter.Id); objTestCenter.Updatedon = DateTime.Now; dbContext.Entry(_objTestCenter).CurrentValues.SetValues(objTestCenter); dbContext.SaveChanges(); } return("Success"); }