Пример #1
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            var model   = new StoryFormModel();
            var story   = StoryRepository.StoryFetch(id);
            var project = ProjectRepository.ProjectFetch(story.ProjectId);

            this.Map(collection, story);

            story = StoryRepository.StorySave(story);

            if (story.IsValid)
            {
                return(this.RedirectToAction("Details", new { id = story.StoryId }));
            }

            model.Title    = "Story Edit";
            model.Story    = story;
            model.Sprints  = SprintRepository.SprintFetchInfoList(project);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId);

            ModelHelper.MapBrokenRules(this.ModelState, story);

            return(this.View(model));
        }
Пример #2
0
        public void Story_Fetch()
        {
            var story = StoryTestHelper.StoryNew();

            story = StoryRepository.StorySave(story);

            story = StoryRepository.StoryFetch(story.StoryId);

            Assert.IsTrue(story != null, "Row returned should not equal null");
        }
Пример #3
0
        public ActionResult Edit(int id)
        {
            var model = new HourFormModel();
            var hour  = HourRepository.HourFetch(id);

            model.Title = "Hour Edit";
            model.Hour  = hour;
            model.Story = StoryRepository.StoryFetch(hour.StoryId);

            return(this.View(model));
        }
Пример #4
0
        public void Story_Add()
        {
            var story = StoryTestHelper.StoryNew();

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

            story = StoryRepository.StorySave(story);

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

            StoryRepository.StoryFetch(story.StoryId);
        }
Пример #5
0
        public ActionResult Create(int storyId)
        {
            var model = new HourFormModel();
            var hour  = HourRepository.HourNew();

            hour.StoryId = storyId;

            model.Title = "Hour Create";
            model.Hour  = hour;
            model.Story = StoryRepository.StoryFetch(storyId);

            return(this.View(model));
        }
Пример #6
0
        public ActionResult Delete(int id)
        {
            var model = new DeleteModel();
            var story = StoryRepository.StoryFetch(id);

            model.Title          = "Story Delete";
            model.Id             = story.StoryId;
            model.Name           = "Story";
            model.Description    = story.Description;
            model.ControllerName = "Story";
            model.BackUrl        = Url.Action("Details", "Story", new { id = story.StoryId });

            return(this.View(model));
        }
Пример #7
0
        public ActionResult Edit(int id)
        {
            var model   = new StoryFormModel();
            var story   = StoryRepository.StoryFetch(id);
            var project = ProjectRepository.ProjectFetch(story.ProjectId);

            model.Title    = "Story Edit";
            model.Story    = story;
            model.Sprints  = SprintRepository.SprintFetchInfoList(project);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId);

            return(this.View(model));
        }
Пример #8
0
        public ActionResult Details(int id)
        {
            var model = new StoryFormModel();
            var story = StoryRepository.StoryFetch(id);

            model.Title       = string.Format("Story {0}", story.Description);
            model.Story       = story;
            model.Notes       = NoteRepository.NoteFetchInfoList(id, SourceType.Story);
            model.Attachments = AttachmentRepository.AttachmentFetchInfoList(
                model.Notes.Select(row => row.NoteId).Distinct().ToArray(), SourceType.Note);
            model.Hours    = HourRepository.HourFetchInfoList(story);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Actions.Add("Edit this story", Url.Action("Edit", new { id }), "primary");
            model.Actions.Add("Add an hour", Url.Action("Create", "Hour", new { storyId = id }));
            model.Actions.Add("Add an email", string.Empty);
            model.Actions.Add("Add a note", Url.Action("Create", "Note", new { sourceId = id, sourceTypeId = (int)SourceType.Story }));

            return(this.View(model));
        }
Пример #9
0
        public void Story_Edit()
        {
            var story = StoryTestHelper.StoryNew();

            var description = story.Description;

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

            story = StoryRepository.StorySave(story);

            story = StoryRepository.StoryFetch(story.StoryId);

            story.Description = DataHelper.RandomString(20);

            story = StoryRepository.StorySave(story);

            story = StoryRepository.StoryFetch(story.StoryId);

            Assert.IsTrue(story.Description != description, "Description should have different value");
        }
Пример #10
0
        public void Story_Delete()
        {
            var story = StoryTestHelper.StoryNew();

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

            story = StoryRepository.StorySave(story);

            story = StoryRepository.StoryFetch(story.StoryId);

            StoryRepository.StoryDelete(story.StoryId);

            try
            {
                StoryRepository.StoryFetch(story.StoryId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
Пример #11
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            var model = new HourFormModel();
            var hour  = HourRepository.HourFetch(id);

            this.Map(collection, hour);

            hour = HourRepository.HourSave(hour);

            if (hour.IsValid)
            {
                return(this.RedirectToAction("Details", "Story", new { id = hour.StoryId }));
            }

            model.Title = "Hour Edit";
            model.Hour  = hour;
            model.Story = StoryRepository.StoryFetch(hour.StoryId);

            ModelHelper.MapBrokenRules(this.ModelState, hour);

            return(this.View(model));
        }