Esempio n. 1
0
        public ActionResult Create(SupportTeam supportTeam)
        {
            try
            {
                if (ViewData.ModelState.IsValid)
                {
                    supportTeam.LastUpdateTimeStamp = DateTime.Now;
                    supportTeam.LastUpdateUser      = GetCurrentUser().Id;
                    ActionConfirmation saveOrUpdateConfirmation =
                        _supportTeamManagementService.SaveOrUpdate(supportTeam);

                    if (saveOrUpdateConfirmation.WasSuccessful)
                    {
                        TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] =
                            saveOrUpdateConfirmation.Message;
                        return(RedirectToAction("Search"));
                    }
                }
                else
                {
                    supportTeam = null;
                }
            }
            catch (PreconditionException pce)
            {
                TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] =
                    pce.Message;
            }

            SupportTeamFormViewModel viewModel =
                _supportTeamManagementService.CreateFormViewModelFor(supportTeam);

            return(View(viewModel));
        }
Esempio n. 2
0
        public void CanSaveOrUpdateValidSupportTeam()
        {
            // Establish Context
            SupportTeam validSupportTeam =
                SupportTeamInstanceFactory.CreateValidTransientSupportTeam();

            // Act
            ActionConfirmation confirmation =
                supportTeamManagementService.SaveOrUpdate(validSupportTeam);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldNotBeNull();
            confirmation.Value.ShouldEqual(validSupportTeam);
        }