Пример #1
0
        public ActionResult Save(FormCollection formcollection)
        {
            //Values required for updating the issue
            int issueId         = GetValue(formcollection["IssueId"]);
            int assignedTo      = GetValue(formcollection["AssignedTo"]);
            int issueStatusName = GetValue(formcollection["IssueStatusName"]);

            Issue currentIssue = issue.GetIssueById(issueId);

            if (issue != null)
            {
                if (assignedTo != -1)
                {
                    currentIssue.AssignedTo = assignedTo;
                }

                if (issueStatusName != -1)
                {
                    currentIssue.IssueStatus = issueStatusName;
                }
                issue.SaveChanges();
                issue.AddHistoryEntry(currentIssue);
            }

            //Values required for remembering the filters applied
            string reasonFilter = String.Empty;

            if (formcollection["ReasonFilter"] != "/")
            {
                reasonFilter = formcollection["ReasonFilter"];
            }

            //Write values into Session variables
            Session["StatusId"]              = GetValue(formcollection["StatusId"]);
            Session["AssignedToFilter"]      = GetValue(formcollection["AssignedToFilter"]);
            Session["IssueStatusNameFilter"] = GetValue(formcollection["IssueStatusNameFilter"]);
            Session["ReasonFilter"]          = reasonFilter;
            Session["PageNumber"]            = GetValue(formcollection["Page"]);

            return(RedirectToAction("Index"));
        }