public ActionResult Index(long id, string backUrl)
        {
            Issue issue;
            if (!ProjectContext.Issues.TryGetById(id, out issue))
                throw new ApplicationException("issue with id = " + id + " was not found!");

            var model = new IssueModel
            {
                Id = issue.Id,
                Summary = issue.Summary,
                Description = issue.Description,
                ReporterId = issue.Reporter.Id,
                ReporterName = issue.Reporter.Name,
                Priority = issue.Priority,
                State = issue.State,
                StoryPoints = issue.StoryPoints,
                Tags = issue.Tags,
                Type = issue.Type,
                AssigneeId = issue.AssigneeId,
                AssigneeName = issue.Assignee != null ? issue.Assignee.Name : "Not Assigned",
                TimeSpent = issue.TimeSpent,
                RemainingEstimate = issue.RemainingEstimate.HasValue ? issue.RemainingEstimate.ToString() : "Not Specified"
            };

            if (!string.IsNullOrEmpty(backUrl))
                ViewData.SetBackLink(Server.UrlDecode(backUrl));

            return View("Issue", model);
        }
        public ActionResult AddIssue(IssueType type, string summary)
        {
            if (string.IsNullOrWhiteSpace(summary))
                summary = string.Empty;

            var model = new IssueModel
            {
                Type = type,
                Summary = summary
            };

            return PartialView("_AddIssue", model);
        }
Exemple #3
0
        public ActionResult CloseIssue(long issueId)
        {
            Issue issue;
            if (!ProjectContext.Issues.TryGetById(issueId, out issue))
                throw new ApplicationException("issue with id = " + issueId + " was not found!");

            var model = new IssueModel
            {
                Id = issue.Id,
            };

            return PartialView("_CloseIssue", model);
        }
Exemple #4
0
        public ActionResult CloseIssue(IssueModel model)
        {
            Issue issue;
            if (!ProjectContext.Issues.TryGetById(model.Id, out issue))
                throw new ApplicationException("issue with id = " + model.Id + " was not found!");

            issue.State = ScheduleState.Done;

            ProjectContext.TrackIssueProgress(issue, IssueProgressType.StatusChanged);

            Context.SaveChanges();

            return JsonSuccess(Url.Action("Board", "Work"));
        }
        public ActionResult AddIssue(IssueModel model)
        {
            if (ModelState.IsValid)
            {
                Context.Database.Issues.Add(new Issue(model.Summary, model.Type, ProjectId, model.ReporterId)
                {
                    State = ScheduleState.Backlog,
                    Description = model.Description,
                    ReporterId = model.ReporterId,
                    Priority = model.Priority,
                    StoryPoints = model.StoryPoints
                });

                Context.SaveChanges();
            }

            return JsonView(ModelState.IsValid, "_AddIssue", model);
        }
        public ActionResult Edit(IssueModel model)
        {
            if (ModelState.IsValid)
            {
                Issue issue;
                if (!ProjectContext.Issues.TryGetById(model.Id, out issue))
                    throw new ApplicationException("issue with id = " + model.Id + " was not found!");

                var reporter = Context.Users.GetById(model.ReporterId);

                issue.Summary = model.Summary;
                issue.Description = model.Description;
                issue.Reporter = reporter;
                issue.Priority = model.Priority;
                issue.StoryPoints = model.StoryPoints;
                issue.Tags = model.Tags;
                issue.State = model.State;

                Context.SaveChanges();

                return this.RedirectToAction(x => x.Index());
            }

            return View("EditIssue", model);
        }
        public ActionResult Edit(long id)
        {
            Issue issue;
            if (!ProjectContext.Issues.TryGetById(id, out issue))
                throw new ApplicationException("issue with id = " + id + " was not found!");

            var model = new IssueModel
            {
                Id = issue.Id,
                Description = issue.Description,
                Summary = issue.Summary,
                ReporterId = issue.Reporter.Id,
                ReporterName = issue.Reporter.Name,
                Priority = issue.Priority,
                State = issue.State,
                StoryPoints = issue.StoryPoints,
                Tags = issue.Tags.ToList(),
                Type = issue.Type
            };

            return View("EditIssue", model);
        }