Exemple #1
0
        public ActionResult CopyApproach(int versionId, int approachID)
        {
            var signal = _signalsRepository.GetSignalVersionByVersionId(versionId);

            //Approach approachFromDatabase = signal.Approaches.Where(a => a.ApproachID == approachID).First();
            AddSelectListsToViewBag(signal);
            try
            {
                Approach newApproach = Approach.CopyApproach(approachID);
                _approachRepository.AddOrUpdate(newApproach);
                return(Content("<h1>Copy Successful!</h1>"));
            }
            catch (Exception ex)
            {
                return(Content("<h1>" + ex.Message + "</h1>"));
            }
        }
Exemple #2
0
        public void CopyApproachTest()
        {
            InMemoryApproachRepository ar = new InMemoryApproachRepository();
            Approach a = new Approach();

            a.SignalID    = "101";
            a.ApproachID  = 1;
            a.Description = "TestAppr";



            ar.AddOrUpdate(a);

            MOE.Common.Models.Repositories.ApproachRepositoryFactory.SetApproachRepository(ar);



            Approach b = Approach.CopyApproach(1);

            Assert.IsTrue(b.Description == "TestAppr Copy");
        }