Exemplo n.º 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));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
        public ActionResult Create(int projectId, int?sprintId)
        {
            var model   = new StoryFormModel();
            var story   = StoryRepository.StoryNew();
            var project = ProjectRepository.ProjectFetch(projectId);

            story.ProjectId = projectId;
            story.SprintId  = sprintId ?? 0;

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

            return(this.View(model));
        }
Exemplo n.º 4
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));
        }