public ActionResult Menu(MenuModelView model) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account", null)); } if (ModelState.IsValid) { model.user = User.Identity.Name; model.status = Convert.ToInt16(model.statusb); if (model.menuid != 0) //update { ServiceMenu.UpdateMenu(model); } else //insert { ServiceMenu.InsertMenu(model); } return(Redirect(Domain.Util.config.UrlSite + "Meni/Menu")); } model.menus = ServiceMenu.getMenu(); return(View(model)); }
/// <summary> /// Constructor of interaction logic for MainWindow.xaml /// </summary> public MainWindow() { InitializeComponent(); Mediator = new ModelViewMediator(this); ControlModelView controlNotifiableModelView = new ControlModelView(Mediator); this.InfoControl.DataContext = controlNotifiableModelView; PaintModelView paintNotifiableModelView = new PaintModelView(Mediator, this); this.PaintControl.DataContext = paintNotifiableModelView; this.GridLowerPanel.DataContext = paintNotifiableModelView; MenuModelView menuNotifiableModelView = new MenuModelView(Mediator, this); this.MenuControl.DataContext = menuNotifiableModelView; this.Mediator.Initialize(); this.RenderingProvider = new RenderProvider( new RenderFactory(this), this.Mediator.AppSettings.DefaultRenderMode); this.RegisterDepencencyMapping(); }
public IActionResult Index() { MenuModelView myMod = new MenuModelView(); myMod.IceCreamMV = _db.AllFlavours.ToList(); myMod.PizzaMV = _db.AllPizzas.ToList(); return(View(myMod)); }
public static void InsertMenu(MenuModelView model) { Menu objretorno = new Menu(); //faz o de para: objModelView para objEntity Mapper.CreateMap <MenuModelView, Menu>(); var objtpprod = Mapper.Map <Menu>(model); MenuRepository tpprod = new MenuRepository(); tpprod.Add(objtpprod); tpprod.Save(); }
public static void UpdateMenu(MenuModelView model) { Menu objretorno = new Menu(); //faz o de para: objModelView para objEntity Mapper.CreateMap <MenuModelView, Menu>(); var objtpprod = Mapper.Map <Menu>(model); //objtpprod.dataincl = DateTime.Now; MenuRepository tpprod = new MenuRepository(); tpprod.Edit(objtpprod); tpprod.Save(); }
public ActionResult Menu(Int16 id = 0) { var model = new MenuModelView(); if (id != 0) { //busca as informações para edição model = ServiceMenu.GetMenuId(id); } model.menus = ServiceMenu.getMenu(); return(View(model)); }
/// <summary> /// Constroi um modelo de menu com base em uma ModelView /// </summary> /// <param name="model">The model.</param> /// <returns></returns> public static Menu BuildModel(MenuModelView model) { Menu menu = new Menu() { Action = model.Action, Area = model.Area, Controller = model.Controller, Descricao = model.Descricao, Grupo = model.Grupo, Id = model.Id, Location = model.Location, Icon = model.Icon }; return(menu); }
/// <summary> /// constroi uma Model View como base em uma Model /// </summary> /// <param name="model">The model.</param> /// <returns></returns> public static MenuModelView BuildModelView(Menu model) { MenuModelView modelView = new MenuModelView() { Role = model.Role.Id, Id = model.Id, Action = model.Action, Area = model.Area, Controller = model.Controller, Descricao = model.Descricao, Grupo = model.Grupo, Location = model.Location, Icon = model.Icon }; return(modelView); }
public ActionResult IncluirMenu(MenuModelView model) { if (model == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (!ModelState.IsValid) { ViewBag.Role = new SelectList(roleDAO.List(), "Id", "Description", model.Role); return(View(model)); } var menu = MenuFactory.BuildModel(model); menu.Role = roleDAO.GetById(model.Role); menuDAO.Add(menu); return(RedirectToAction("IndexMenus")); }
/// <summary> /// Constructor for class responsible for all disk interaction /// </summary> /// <param name="menuModelView"><see cref="Bspline.WpfUI.ModelViews.MenuModelView"/> to which this object will delegate to</param> public FileManager(MenuModelView menuModelView) { this.MenuModelView = menuModelView; }
/// <summary> /// <see cref="Bspline.Core.DisposableObject"/> /// </summary> protected override void DisposeInner() { this.MenuModelView = null; }