Exemplo n.º 1
0
 private void AssertPeriodForEntity(Data.Period period, PeriodEntity entity)
 {
     Assert.AreEqual(entity.Id, period.Id);
     Assert.AreEqual(entity.CalendarMonth, period.CalendarMonth);
     Assert.AreEqual(entity.CalendarYear, period.CalendarYear);
     Assert.AreEqual(entity.AccountDataValidAt, period.AccountDataValidAt);
     Assert.AreEqual(entity.CommitmentDataValidAt, period.CommitmentDataValidAt);
     Assert.AreEqual(entity.CompletionDateTime, period.CompletionDateTime);
 }
Exemplo n.º 2
0
        public ActionResult AddPeriod(AdminPeriodsViewModel Model)
        {
            PopulateModel(Model);
            if (!ModelState.IsValid)
            {
                return(View(Model));
            }

            var Period = new Data.Period();

            Period.CompanyId            = Model.CompanyId;
            Period.PeriodStart          = Model.SelectedPeriod.PeriodStart;
            Period.PeriodEnd            = ((DateTime)Model.SelectedPeriod.PeriodStart).AddDays(6);
            Period.Reminder1Date        = Model.SelectedPeriod.Reminder1Date;
            Period.Reminder2Date        = Model.SelectedPeriod.Reminder2Date;
            Period.PeriodStatusId       = 0;
            Context.Entry(Period).State = System.Data.Entity.EntityState.Added;
            Context.SaveChanges();

            return(RedirectPermanent("/" + Model.CompanyURL + "/AdminPeriods"));
        }