コード例 #1
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            var week = WeekRepository.WeekFetch(id);

            WeekRepository.WeekDelete(id);

            return(this.RedirectToAction("Index", new { year = week.Year }));
        }
コード例 #2
0
        public ActionResult Edit(int id)
        {
            var model = new WeekEditModel();
            var week  = WeekRepository.WeekFetch(id);

            model.Title = "Week Edit";
            model.Week  = week;

            return(this.View(model));
        }
コード例 #3
0
ファイル: WeekTest.cs プロジェクト: chandusekhar/epiworx-csla
        public void Week_Fetch()
        {
            var week = WeekTestHelper.WeekNew();

            week = WeekRepository.WeekSave(week);

            week = WeekRepository.WeekFetch(week.WeekId);

            Assert.IsTrue(week != null, "Row returned should not equal null");
        }
コード例 #4
0
ファイル: WeekTest.cs プロジェクト: chandusekhar/epiworx-csla
        public void Week_Add()
        {
            var week = WeekTestHelper.WeekNew();

            Assert.IsTrue(week.IsValid, "IsValid should be true");

            week = WeekRepository.WeekSave(week);

            Assert.IsTrue(week.WeekId != 0, "WeekId should be a non-zero value");

            WeekRepository.WeekFetch(week.WeekId);
        }
コード例 #5
0
        public ActionResult Delete(int id)
        {
            var model = new DeleteModel();
            var week  = WeekRepository.WeekFetch(id);

            model.Title          = "Week Delete";
            model.Id             = week.WeekId;
            model.Name           = "Week";
            model.Description    = week.StartDate.ToShortDateString();
            model.ControllerName = "Week";
            model.BackUrl        = Url.Action("Index", "Week", new { year = week.Year });

            return(this.View(model));
        }
コード例 #6
0
ファイル: WeekTest.cs プロジェクト: chandusekhar/epiworx-csla
        public void Week_Edit()
        {
            var week = WeekTestHelper.WeekNew();

            var name = week.StartDate;

            Assert.IsTrue(week.IsValid, "IsValid should be true");

            week = WeekRepository.WeekSave(week);

            week = WeekRepository.WeekFetch(week.WeekId);

            week.StartDate = week.StartDate.AddDays(1);

            week = WeekRepository.WeekSave(week);

            week = WeekRepository.WeekFetch(week.WeekId);

            Assert.IsTrue(week.StartDate != name, "Name should have different value");
        }
コード例 #7
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            var model = new WeekEditModel();
            var week  = WeekRepository.WeekFetch(id);

            this.Map(collection, week);

            week = WeekRepository.WeekSave(week);

            if (week.IsValid)
            {
                return(this.RedirectToAction("Index", new { year = week.Year }));
            }

            model.Title = "Week Edit";
            model.Week  = week;

            ModelHelper.MapBrokenRules(this.ModelState, week);

            return(this.View(model));
        }
コード例 #8
0
ファイル: WeekTest.cs プロジェクト: chandusekhar/epiworx-csla
        public void Week_Delete()
        {
            var week = WeekTestHelper.WeekNew();

            Assert.IsTrue(week.IsValid, "IsValid should be true");

            week = WeekRepository.WeekSave(week);

            week = WeekRepository.WeekFetch(week.WeekId);

            WeekRepository.WeekDelete(week.WeekId);

            try
            {
                WeekRepository.WeekFetch(week.WeekId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }