public Tuple <Boolean, String, PeriodManagement> AddPeriodManagement(PeriodManagement periodManagement) { try { db.Add(periodManagement); db.SaveChanges(); return(Tuple.Create(true, "Data Inserted Successfully", periodManagement)); } catch (Exception ex) { return(Tuple.Create(false, ex.Message, periodManagement)); } }
public Tuple <Boolean, String, PeriodManagement> UpdatePeriodManagement(PeriodManagement pm) { try { var q = db.PeriodManagement.Where(x => x.PeriodId == pm.PeriodId).FirstOrDefault(); q.Year = pm.Year; q.Period = pm.Period; q.Description = pm.Description; q.StartDate = pm.StartDate; q.EndDate = pm.EndDate; q.Date = pm.Date; q.Active = pm.Active; db.SaveChanges(); return(Tuple.Create(true, "Data updated successfully", q)); } catch (Exception ex) { return(Tuple.Create(false, ex.Message, pm)); } }