Exemplo n.º 1
0
        public void CanSaveOrUpdateValidRequestStatus()
        {
            // Establish Context
            RequestStatus validRequestStatus =
                RequestStatusInstanceFactory.CreateValidTransientRequestStatus();

            // Act
            ActionConfirmation confirmation =
                _requestStatusManagementService.SaveOrUpdate(validRequestStatus);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldNotBeNull();
            confirmation.Value.ShouldEqual(validRequestStatus);
        }
Exemplo n.º 2
0
        public ActionResult Create(RequestStatus requestStatus)
        {
            if (ViewData.ModelState.IsValid)
            {
                requestStatus.LastUpdateTimeStamp = DateTime.Now;
                requestStatus.LastUpdateUser      = GetCurrentUser().Id;
                ActionConfirmation saveOrUpdateConfirmation =
                    _requestStatusManagementService.SaveOrUpdate(requestStatus);

                if (saveOrUpdateConfirmation.WasSuccessful)
                {
                    TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] =
                        saveOrUpdateConfirmation.Message;
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                requestStatus = null;
            }

            RequestStatusFormViewModel viewModel =
                _requestStatusManagementService.CreateFormViewModelFor(requestStatus);

            return(View(viewModel));
        }