Exemplo n.º 1
0
        public async Task <ActionResult> AddItemAsync(string menuItemName, string menuItemCatergory)
        {
            MenuItemRepository rep   = new MenuItemRepository(sqlConnection);
            MenuItemModel      model = new MenuItemModel();


            model.UserId    = User.Identity.GetUserId();
            model.Name      = menuItemName;
            model.Catergory = menuItemCatergory;
            model.Added     = DateTime.UtcNow;
            model.Modified  = model.Added;

            int idret = await rep.CreateItem(model);

            if (idret < 0)
            {
                return(Redirect("/Menu/Add"));
            }
            else
            {
                return(Redirect("/Menu/Edit/" + idret));
            }
        }