public void CannotUpdateInvalidApplicationFromForm()
        {
            // Establish Context
            var applicationFromForm = new Application();
            var viewModelToExpect   = new ApplicationFormViewModel();

            var testUser = PersonInstanceFactory.CreateValidTransientPerson();

            testUser.SetAssignedIdTo(1);
            _authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("testuser");
            _personManagementService.Expect(r => r.GetByUserName(Arg <string> .Is.Anything)).Return(testUser);

            _applicationManagementService.Expect(r => r.UpdateWith(applicationFromForm, 0))
            .Return(ActionConfirmation.CreateFailureConfirmation("not updated"));
            _applicationManagementService.Expect(r => r.CreateFormViewModelFor(applicationFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                _applicationsController.Edit(applicationFromForm).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as ApplicationFormViewModel).ShouldNotBeNull();
        }
        public ActionConfirmation ValidateUser(UserDto userToValidate)
        {
            Person user;

            try
            {
                _securityProvider.Authenticate(userToValidate.UserName, userToValidate.Password);
                if (!_securityProvider.IsAuthenticated)
                {
                    return(ActionConfirmation.CreateFailureConfirmation("Invalid network user name or password"));
                }
                user = _personRepository.GetByUserName(userToValidate.UserName);
                if (user == null)
                {
                    return(ActionConfirmation.CreateFailureConfirmation("User not found"));
                }
                return(ActionConfirmation.CreateSuccessConfirmation(""));
            }
            catch (InvalidPasswordException)
            {
                return(ActionConfirmation.CreateFailureConfirmation("Invalid network user name or password"));
            }
            catch (NetworkUserNotFoundException)
            {
                return(ActionConfirmation.CreateFailureConfirmation("Invalid Network User Name or Password"));
            }
            catch (Exception ex)
            {
                throw new Exception("Encountered an error while attempting to validate username and password", ex);
            }
        }
示例#3
0
        public ActionConfirmation Delete(int id)
        {
            Request requestToDelete = _requestRepository.Get(id);

            if (requestToDelete != null)
            {
                _requestEstimateManagementService.DeleteByRequest(id);
                _requestRepository.Delete(requestToDelete);

                try
                {
                    _requestRepository.DbContext.CommitChanges();

                    return(ActionConfirmation.CreateSuccessConfirmation(
                               "The request was successfully deleted."));
                }
                catch
                {
                    _requestRepository.DbContext.RollbackTransaction();

                    return(ActionConfirmation.CreateFailureConfirmation(
                               "A problem was encountered preventing the request from being deleted. " +
                               "Another item likely depends on this request."));
                }
            }
            else
            {
                return(ActionConfirmation.CreateFailureConfirmation(
                           "The request could not be found for deletion. It may already have been deleted."));
            }
        }
        public void CannotCreateInvalidSupportTeamFromForm()
        {
            // Establish Context
            var supportTeamFromForm = new SupportTeam();
            var viewModelToExpect   = new SupportTeamFormViewModel();

            var testUser = new Person();

            testUser.SetAssignedIdTo(1);
            _authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("user1");
            _personManagementService.Expect(r => r.GetByUserName("user1")).Return(testUser);


            supportTeamManagementService.Expect(r => r.SaveOrUpdate(supportTeamFromForm))
            .Return(ActionConfirmation.CreateFailureConfirmation("not saved"));
            supportTeamManagementService.Expect(r => r.CreateFormViewModelFor(supportTeamFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                supportTeamsController.Create(supportTeamFromForm).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as SupportTeamFormViewModel).ShouldNotBeNull();
        }
示例#5
0
        public ActionConfirmation SaveOrUpdate(Request request)
        {
            if (request.IsValid())
            {
                ValidateRequest(request);
                if (request.IsRequestSignedOff == null)
                {
                    request.IsRequestSignedOff = false;
                }
                _requestRepository.SaveOrUpdate(request);
                if (!SaveEstimate(request))
                {
                    _requestRepository.DbContext.RollbackTransaction();
                    return(ActionConfirmation.CreateFailureConfirmation(
                               "The request could not be saved due to missing or invalid information."));
                }
                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The request was successfully saved.");
                saveOrUpdateConfirmation.Value = request;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _requestRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The request could not be saved due to missing or invalid information."));
            }
        }
示例#6
0
        public ActionConfirmation UpdateWith(Request requestFromForm, int idOfRequestToUpdate)
        {
            Request requestToUpdate =
                _requestRepository.Get(idOfRequestToUpdate);

            ValidateRequest(requestFromForm);

            TransferFormValuesTo(requestToUpdate, requestFromForm);

            if (requestToUpdate.IsValid())
            {
                if (!SaveEstimate(requestToUpdate))
                {
                    _requestRepository.DbContext.RollbackTransaction();
                    return(ActionConfirmation.CreateFailureConfirmation(
                               "The request could not be saved due to missing or invalid information."));
                }
                ActionConfirmation updateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The request was successfully updated.");
                updateConfirmation.Value = requestToUpdate;

                return(updateConfirmation);
            }
            else
            {
                _requestRepository.DbContext.RollbackTransaction();


                return(ActionConfirmation.CreateFailureConfirmation(
                           "The request could not be saved due to missing or invalid information."));
            }
        }
        public virtual ActionConfirmation <T> Delete(int id)
        {
            T toDelete = _entityRepository.Get(id);

            if (toDelete != null)
            {
                try {
                    _entityRepository.Delete(toDelete);
                    return(ActionConfirmation <T> .CreateSuccessConfirmation(
                               "The " + GetFriendlyNameOfType() + " was successfully deleted.", toDelete));
                }
                // A foreign key constraint violation will thrown an exception.  As inadvisable as it use
                // to use exceptions as a means of business logic, this is certainly the easiest way to to do it.
                catch {
                    // Since we're swallowing the exception, we want to make sure the transaction gets rolled back
                    _entityRepository.DbContext.RollbackTransaction();

                    return(ActionConfirmation <T> .CreateFailureConfirmation(
                               "The " + GetFriendlyNameOfType() + " could not be deleted; another item depends on it.", toDelete));
                }
            }

            return(ActionConfirmation <T> .CreateFailureConfirmation(
                       "The " + GetFriendlyNameOfType() + " could not be found for deletion. It may already have been deleted.", default(T)));
        }
示例#8
0
        public ActionConfirmation UpdateWith(Host hostFromForm, int idOfHostToUpdate)
        {
            Host hostToUpdate =
                _hostRepository.Get(idOfHostToUpdate);

            ValidateHost(hostFromForm);

            TransferFormValuesTo(hostToUpdate, hostFromForm);

            if (hostToUpdate.IsValid())
            {
                ActionConfirmation updateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The host was successfully updated.");
                updateConfirmation.Value = hostToUpdate;

                return(updateConfirmation);
            }
            else
            {
                _hostRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The host could not be saved due to missing or invalid information."));
            }
        }
示例#9
0
        public void CannotUpdateInvalidPersonFromForm()
        {
            // Establish Context
            var personFromForm    = new Person();
            var viewModelToExpect = new PersonFormViewModel();

            var testUser = new Person();

            testUser.SetAssignedIdTo(1);
            _authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("user1");
            _personManagementService.Expect(r => r.GetByUserName("user1")).Return(testUser);

            _personManagementService.Expect(r => r.UpdateWith(personFromForm, 0))
            .Return(ActionConfirmation.CreateFailureConfirmation("not updated"));
            _personManagementService.Expect(r => r.CreateFormViewModelFor(personFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                _peopleController.Edit(personFromForm).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as PersonFormViewModel).ShouldNotBeNull();
        }
示例#10
0
        public ActionConfirmation UpdateWith(Template templateFromForm, int idOfTemplateToUpdate, string fileName, byte[] fileByteArray)
        {
            Template templateToUpdate =
                templateRepository.Get(idOfTemplateToUpdate);

            TransferFormValuesTo(templateToUpdate, templateFromForm);

            if (fileByteArray != null)
            {
                SaveFile(templateToUpdate, fileName, fileByteArray);
            }

            if (templateToUpdate.IsValid())
            {
                ActionConfirmation updateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The template was successfully updated.");
                updateConfirmation.Value = templateToUpdate;

                return(updateConfirmation);
            }
            else
            {
                templateRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The template could not be saved due to missing or invalid information."));
            }
        }
        public void CannotCreateInvalidTimeEntryFromForm()
        {
            // Establish Context
            var timeEntryFromForm = new TimeEntry();
            var viewModelToExpect = new TimeEntryFormViewModel();

            _timeEntryManagementService.Expect(r => r.SaveOrUpdate(Arg <TimeEntry> .Is.Anything))
            .Return(ActionConfirmation.CreateFailureConfirmation("not saved"));
            _timeEntryManagementService.Expect(
                r => r.CreateFormViewModelFor(Arg <TimeEntry> .Is.Anything, Arg <string> .Is.Anything))
            .Return(viewModelToExpect);
            _authenticationProvider.Expect(x => x.GetLoggedInUser()).Return("testuser");
            _personManagementService.Expect(x => x.GetByUserName(Arg <string> .Is.Anything)).Return(
                PersonInstanceFactory.CreateValidTransientPerson());

            // Act
            RedirectToRouteResult result =
                _timeEntriesController.Create(timeEntryFromForm).AssertActionRedirect().ToAction("Index");

            // Assert
            //result.ViewData.Model.ShouldNotBeNull();
            //(result.ViewData.Model as TimeEntryFormViewModel).ShouldNotBeNull();

            //_timeEntriesController.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()].ToString().ShouldEqual("updated");
        }
        public ActionConfirmation Delete(int id)
        {
            SlideFolder slideFolderToDelete = slideFolderRepository.Get(id);

            if (slideFolderToDelete != null)
            {
                slideFolderRepository.Delete(slideFolderToDelete);

                try {
                    slideFolderRepository.DbContext.CommitChanges();

                    return(ActionConfirmation.CreateSuccessConfirmation(
                               "The slideFolder was successfully deleted."));
                }
                catch {
                    slideFolderRepository.DbContext.RollbackTransaction();

                    return(ActionConfirmation.CreateFailureConfirmation(
                               "A problem was encountered preventing the slideFolder from being deleted. " +
                               "Another item likely depends on this slideFolder."));
                }
            }
            else
            {
                return(ActionConfirmation.CreateFailureConfirmation(
                           "The slideFolder could not be found for deletion. It may already have been deleted."));
            }
        }
        public ActionConfirmation Delete(int id)
        {
            TimeEntry timeEntryToDelete = _timeEntryRepository.Get(id);

            if (timeEntryToDelete != null)
            {
                _timeEntryRepository.Delete(timeEntryToDelete);

                try
                {
                    _timeEntryRepository.DbContext.CommitChanges();

                    return(ActionConfirmation.CreateSuccessConfirmation(
                               "The Time Entry was successfully deleted."));
                }
                catch
                {
                    _timeEntryRepository.DbContext.RollbackTransaction();

                    return(ActionConfirmation.CreateFailureConfirmation(
                               "A problem was encountered preventing the Time Entry from being deleted. " +
                               "Another item likely depends on this Time Entry."));
                }
            }
            else
            {
                return(ActionConfirmation.CreateFailureConfirmation(
                           "The Time Entry could not be found for deletion. It may already have been deleted."));
            }
        }
示例#14
0
        public ActionConfirmation Refresh()
        {
            try
            {
                //NHibernateSession.GetDefaultSessionFactory().OpenSession();
                var rssFeeds = rSSFeedRepository.GetAll();
                foreach (var rssFeed in rssFeeds)
                {
                    rSSFeedRepository.DbContext.BeginTransaction();
                    Run(rssFeed);
                    rSSFeedRepository.DbContext.CommitChanges();
                    rSSFeedRepository.DbContext.CommitTransaction();
                }

                NHibernateSession.Current.Clear();

                List <string> filesToDelete = new List <string>();
                var           slideFolders  = slideFolderRepository.GetSlideFoldersWithTooManySlides();
                slideFolderRepository.DbContext.BeginTransaction();

                foreach (var slideFolder in slideFolders)
                {
                    int numberOfSlideToRemove = slideFolder.SlideCount - slideFolder.MaxSlideCount;
                    for (int x = 0; x < numberOfSlideToRemove; x++)
                    {
                        var slide = slideFolder.Slides[0];
                        filesToDelete.Add(slide.FileFullPathName);
                        slideFolder.Slides.RemoveAt(0);
                        slideRepository.Delete(slide);
                    }
                }
                slideFolderRepository.DbContext.CommitChanges();
                rSSFeedRepository.DbContext.CommitTransaction();

                foreach (var filePath in filesToDelete)
                {
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                }
            }
            catch (Exception ex)
            {
                return(ActionConfirmation.CreateFailureConfirmation(ex.ToString()));
            }
            return(ActionConfirmation.CreateSuccessConfirmation("Success"));
        }
示例#15
0
        public void CannotCreateInvalidChannelFromForm()
        {
            // Establish Context
            Channel channelFromForm = new Channel();
            ChannelFormViewModel viewModelToExpect = new ChannelFormViewModel();

            channelManagementService.Expect(r => r.SaveOrUpdate(channelFromForm))
            .Return(ActionConfirmation.CreateFailureConfirmation("not saved"));
            channelManagementService.Expect(r => r.CreateFormViewModelFor(channelFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                channelsController.Create(channelFromForm).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as ChannelFormViewModel).ShouldNotBeNull();
        }
示例#16
0
        public void CannotUpdateInvalidPublisherFromForm()
        {
            // Establish Context
            Publisher publisherFromForm = new Publisher();
            PublisherFormViewModel viewModelToExpect = new PublisherFormViewModel();

            publisherManagementService.Expect(r => r.UpdateWith(publisherFromForm, 0))
            .Return(ActionConfirmation.CreateFailureConfirmation("not updated"));
            publisherManagementService.Expect(r => r.CreateFormViewModelFor(publisherFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                publishersController.Edit(publisherFromForm).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as PublisherFormViewModel).ShouldNotBeNull();
        }
示例#17
0
        public void CannotUpdateInvalidTemplateFromForm()
        {
            // Establish Context
            Template templateFromForm = new Template();
            TemplateFormViewModel viewModelToExpect = new TemplateFormViewModel();

            templateManagementService.Expect(r => r.UpdateWith(templateFromForm, 0, null, null))
            .Return(ActionConfirmation.CreateFailureConfirmation("not updated"));
            templateManagementService.Expect(r => r.CreateFormViewModelFor(templateFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                templatesController.Edit(templateFromForm, null).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as TemplateFormViewModel).ShouldNotBeNull();
        }
        public ActionConfirmation SaveOrUpdate(TimeEntry timeEntry)
        {
            if (timeEntry.IsValid())
            {
                _timeEntryRepository.SaveOrUpdate(timeEntry);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation("");
                saveOrUpdateConfirmation.Value = timeEntry;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _timeEntryRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The Time Entry could not be saved due to missing or invalid information."));
            }
        }
        public ActionConfirmation DeleteByRequest(int requestId)
        {
            _requestEstimateRepository.DeleteByRequest(requestId);
            try
            {
                _requestEstimateRepository.DbContext.CommitChanges();

                return(ActionConfirmation.CreateSuccessConfirmation(
                           "The requestEstimates were successfully deleted."));
            }
            catch
            {
                _requestEstimateRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "A problem was encountered preventing the requestEstimates from being deleted. " +
                           "Another item likely depends on this Request Estimate."));
            }
        }
        public void CannotUpdateInvalidAssetContentFromForm()
        {
            // Establish Context
            AssetContent assetContentFromForm           = new AssetContent();
            AssetContentFormViewModel viewModelToExpect = new AssetContentFormViewModel();

            assetContentManagementService.Expect(r => r.UpdateWith(assetContentFromForm, 0))
            .Return(ActionConfirmation.CreateFailureConfirmation("not updated"));
            assetContentManagementService.Expect(r => r.CreateFormViewModelFor(assetContentFromForm))
            .Return(viewModelToExpect);

            // Act
            ViewResult result =
                assetContentsController.Edit(assetContentFromForm).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as AssetContentFormViewModel).ShouldNotBeNull();
        }
        public ActionConfirmation SaveOrUpdate(AssetContent assetContent)
        {
            if (assetContent.IsValid())
            {
                assetContentRepository.SaveOrUpdate(assetContent);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The assetContent was successfully saved.");
                saveOrUpdateConfirmation.Value = assetContent;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                assetContentRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The assetContent could not be saved due to missing or invalid information."));
            }
        }
示例#22
0
        public ActionConfirmation SaveOrUpdate(Slide slide)
        {
            if (slide.IsValid())
            {
                slideRepository.SaveOrUpdate(slide);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The slide was successfully saved.");
                saveOrUpdateConfirmation.Value = slide;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                slideRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The slide could not be saved due to missing or invalid information."));
            }
        }
示例#23
0
        public ActionConfirmation SaveOrUpdate(RequestStatus requestStatus)
        {
            if (requestStatus.IsValid())
            {
                _requestStatusRepository.SaveOrUpdate(requestStatus);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The requestStatus was successfully saved.");
                saveOrUpdateConfirmation.Value = requestStatus;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _requestStatusRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The requestStatus could not be saved due to missing or invalid information."));
            }
        }
示例#24
0
        public ActionConfirmation SaveOrUpdate(SupportTeam supportTeam)
        {
            if (supportTeam.IsValid())
            {
                _supportTeamRepository.SaveOrUpdate(supportTeam);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The support team was successfully saved.");
                saveOrUpdateConfirmation.Value = supportTeam;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _supportTeamRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The support team could not be saved due to missing or invalid information."));
            }
        }
示例#25
0
        public ActionConfirmation SaveOrUpdate(Channel channel)
        {
            if (channel.IsValid())
            {
                channelRepository.SaveOrUpdate(channel);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The channel was successfully saved.");
                saveOrUpdateConfirmation.Value = channel;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                channelRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The channel could not be saved due to missing or invalid information."));
            }
        }
示例#26
0
        public ActionConfirmation SaveOrUpdate(Publisher publisher)
        {
            if (publisher.IsValid())
            {
                publisherRepository.SaveOrUpdate(publisher);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The publisher was successfully saved.");
                saveOrUpdateConfirmation.Value = publisher;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                publisherRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The publisher could not be saved due to missing or invalid information."));
            }
        }
示例#27
0
        public ActionConfirmation SaveOrUpdate(RSSFeed rSSFeed)
        {
            if (rSSFeed.IsValid())
            {
                rSSFeedRepository.SaveOrUpdate(rSSFeed);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The rSSFeed was successfully saved.");
                saveOrUpdateConfirmation.Value = rSSFeed;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                rSSFeedRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The rSSFeed could not be saved due to missing or invalid information."));
            }
        }
示例#28
0
        public ActionConfirmation SaveOrUpdate(Application application)
        {
            if (application.IsValid())
            {
                application.SetHostsFromHostId(application.HostIds);
                _applicationRepository.SaveOrUpdate(application);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The application was successfully saved.");
                saveOrUpdateConfirmation.Value = application;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _applicationRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The application could not be saved due to missing or invalid information."));
            }
        }
示例#29
0
        public ActionConfirmation SaveOrUpdate(Host host)
        {
            if (host.IsValid())
            {
                ValidateHost(host);
                _hostRepository.SaveOrUpdate(host);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The host was successfully saved.");
                saveOrUpdateConfirmation.Value = host;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _hostRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The host could not be saved due to missing or invalid information."));
            }
        }
示例#30
0
        public ActionConfirmation SaveOrUpdate(WrmsSystem wrmsSystem)
        {
            if (wrmsSystem.IsValid())
            {
                ValidateWrmsSystem(wrmsSystem);
                _wrmsSystemRepository.SaveOrUpdate(wrmsSystem);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The wrmsSystem was successfully saved.");
                saveOrUpdateConfirmation.Value = wrmsSystem;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _wrmsSystemRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The wrmsSystem could not be saved due to missing or invalid information."));
            }
        }