コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
            }
        }