public int CreateHistory(HistoryModel history) { //History objHistory = new History(); history.IsActive = true; history.CreatedDate = DateTime.Now.Date; history.UpdatedDate = DateTime.Now.Date; using (PhysioDevEntities db = new PhysioDevEntities()) { try { History obj = new History(); history.CopyProperties(obj); db.Histories.Add(obj); db.SaveChanges(); return(1); } catch (Exception ex) { return(0); throw ex; } } }
public int UpdateHistory(HistoryModel objHistory) { using (PhysioDevEntities db = new PhysioDevEntities()) { objHistory.UpdatedDate = DateTime.Now.Date; try { History history = new History(); objHistory.CopyProperties(history); db.Entry(history).State = EntityState.Modified; db.SaveChanges(); return(1); } catch (Exception ex) { return(0); throw ex; } } }