public Tuple <bool, string, long> Update() { try { long id = 0; using (Easycase.DataModel.EasyCaseDBEntities DB = new DataModel.EasyCaseDBEntities()) { var holiday = new DataModel.Holiday { CreatedBy = this.CreatedBy, HolidayOfYear = this.HolidayOfYear, Year = this.Year, ID = this.ID, HolidayDates = this.HolidayDates }; DB.Entry(holiday).State = System.Data.Entity.EntityState.Modified; DB.SaveChanges(); id = holiday.ID; } return(new Tuple <bool, string, long>(true, Messages.SUCCESS, id)); } catch (Exception ex) { Logs.SaveLog(ex.Message); return(new Tuple <bool, string, long>(false, ex.Message, 0)); } }
public Tuple <bool, string, long> Save() { try { long id = 0; using (Easycase.DataModel.EasyCaseDBEntities DB = new DataModel.EasyCaseDBEntities()) { var businessHours = new DataModel.Holiday { CreatedBy = this.CreatedBy, HolidayOfYear = this.HolidayOfYear, Year = this.Year, HolidayDates = this.HolidayDates }; DB.Holidays.Add(businessHours); DB.SaveChanges(); id = businessHours.ID; } return(new Tuple <bool, string, long>(true, Messages.SUCCESS, id)); } catch (Exception ex) { Logs.SaveLog(ex.Message); return(new Tuple <bool, string, long>(false, ex.Message, 0)); } }