Beispiel #1
0
        public ActionResult Create(AplicacionCreateView aplicacion)
        {
            var app = new Aplicacion(aplicacion);

            if (ModelState.IsValid)
            {
                db.Aplicacion.Add(app);

                var order = 0;

                if (aplicacion.Menus != null)
                {
                    foreach (var item in aplicacion.Menus)
                    {
                        if (item.Type != "")
                        {
                            var menu        = new Menu();
                            var cssItemMenu = new CssModel();
                            cssItemMenu.BorderSize = item.CssModelItemMenu.BorderSize;
                            cssItemMenu.ColorBack  = item.CssModelItemMenu.ColorBack;
                            cssItemMenu.ColorIcon  = item.CssModelItemMenu.ColorIcon;
                            cssItemMenu.ColorText  = item.CssModelItemMenu.ColorText;
                            cssItemMenu.FontFamily = item.CssModelItemMenu.FontFamily;
                            db.CssModel.Add(cssItemMenu);

                            menu.CssModelItemMenu = cssItemMenu;
                            menu.Aplicacion       = app;
                            menu.Icon             = item.Icon;
                            menu.Order            = order;
                            menu.Status           = true;
                            menu.TitleMenu        = item.TitleMenu;
                            menu.Type             = item.Type;

                            db.Menu.Add(menu);
                            order++;
                        }
                    }
                }



                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aplicacion));
        }
Beispiel #2
0
        // GET: Aplicaciones/Create
        public ActionResult Create()
        {
            AplicacionCreateView aplicacion = new AplicacionCreateView();
            var types = db.Type.Where(t => t.Status).ToList();

            if (types == null)
            {
                var type = new Models.Type();
                type.InflateType();
                types = db.Type.Where(t => t.Status).ToList();
            }
            else if (types.Count == 0)
            {
                var type = new Models.Type();
                type.InflateType();
                types = db.Type.Where(t => t.Status).ToList();
            }


            ViewBag.Types = types;

            aplicacion.Menus = new List <Menu>();
            return(View(aplicacion));
        }