Ejemplo n.º 1
0
        public MenuFeature DeleteMenuPath2ItemFor(string menuFeatureId, string menuPath2Id)
        {
            menuFeatureId.IsNullOrWhiteSpaceThrowArgumentException();
            menuPath2Id.IsNullOrWhiteSpaceThrowArgumentException();

            //make sure that the menuPath is not already a part of the menuFeature
            MenuFeature mf = MenuFeatureBiz.Find(menuFeatureId);

            mf.IsNullThrowException("Not found");

            //MenuPath2 mp2 = mf.MenuPath2s.FirstOrDefault(x => x.Id == menuPath2Id);

            //if (!mp2.IsNull())
            //{
            //    mf.MenuPath2s.Remove(mp2);
            //    mp2.MenuFeatures.Remove(mf);
            //}

            MenuFeatureBiz.SaveChanges();
            MenuFeatureBiz.Detach(mf);//need to do this otherwise local copy (old) is delivered.
            //freshen the data after save
            mf = MenuFeatureBiz.Find(mf.Id);
            mf.IsNullThrowException("Menu Feauture not found!");

            return(mf);
        }
Ejemplo n.º 2
0
        public MenuFeature AddMenu3ItemTo_Save(string menuFeatureId, string menuPath3Id)
        {
            menuFeatureId.IsNullOrWhiteSpaceThrowArgumentException();
            menuPath3Id.IsNullOrWhiteSpaceThrowArgumentException();

            //make sure that the menuPath is not already a part of the menuFeature
            MenuFeature mf = MenuFeatureBiz.Find(menuFeatureId);

            mf.IsNullThrowException("Not found");

            //MenuPath3 mp3 = mf.MenuPath3s.FirstOrDefault(x => x.Id == menuPath3Id);

            //if (mp3.IsNull())
            //{
            //    MenuPath3 _mp3 = MenuPath3Biz.Find(menuPath3Id);
            //    _mp3.IsNullThrowException("Menu Path not found.");

            //    mf.MenuPath3s.Add(mp3);
            //    _mp3.MenuFeatures.Add(mf);
            //    MenuFeatureBiz.Update(mf);
            //}

            MenuFeatureBiz.SaveChanges();
            MenuFeatureBiz.Detach(mf);//need to do this otherwise local copy (old) is delivered.
            //freshen the data after save
            mf = MenuFeatureBiz.Find(mf.Id);
            mf.IsNullThrowException("Menu Feauture not found!");

            return(mf);
        }