예제 #1
0
        public ActionResult Create(IssueWrapper anIssueWrapper)
        {
            if (!IsLoggedIn()) {
                ViewData["Message"] = MessageHelper.NormalMessage(ISSUE_CREATE_TIMEOUT);
                return View("Create", anIssueWrapper);
            }

            UserInformationModel<User> myUser = GetUserInformatonModel();

            try {

                if (theIssueService.CreateIssue(myUser, anIssueWrapper.ToModel())) {
                    TempData["Message"] += MessageHelper.SuccessMessage(POST_SUCCESS);
                    return RedirectToAction(DETAILS_VIEW, new { title = IssueTitleHelper.ConvertForUrl(anIssueWrapper.Title) });
                }
            } catch (Exception e) {
                LogError(e, CREATING_ISSUE_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(CREATING_ISSUE_ERROR);
            }
            return View("Create", anIssueWrapper);
        }
예제 #2
0
        public ActionResult Edit(IssueWrapper anIssueWrapper)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            try {
                bool myResult = theIssueService.EditIssue(GetUserInformatonModel(), anIssueWrapper.ToModel());
                if (myResult) {
                    TempData["Message"] += MessageHelper.SuccessMessage(EDIT_SUCCESS);
                    return RedirectToAction(REDIRECT_TO_DETAILS_VIEW, new { id = anIssueWrapper.Id });
                }
            } catch (Exception myException) {
                LogError(myException, EDIT_ISSUE_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(EDIT_ISSUE_ERROR);
            }

            return RedirectToAction(EDIT_VIEW, new { id = anIssueWrapper.Id });
        }