Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,CatalogName,CatalogDetails,DateCreated")] Catalog catalog)
        {
            if (ModelState.IsValid)
            {
                context.Add(catalog);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(catalog));
        }
        public async Task <IActionResult> Create([Bind("Id,ClassifyName,ClassifyDetail,DateCreated")] Classify classify)
        {
            if (ModelState.IsValid)
            {
                context.Add(classify);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(classify));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,UserName,Password,FullName,Sex,PhoneNumber,Email,Brithday,Address,JoinDate,IdRole")] UserInformation userInformation)
        {
            if (ModelState.IsValid)
            {
                context.Add(userInformation);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdRole"] = new SelectList(context.Roles, "Id", "Role1", userInformation.IdRole);
            return(View(userInformation));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,IdUser,OrderDate,TotalCost,DeliveryAddress,DeliveryDate")] Order order)
        {
            if (ModelState.IsValid)
            {
                context.Add(order);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdUser"] = new SelectList(context.UserInformations, "Id", "Address", order.IdUser);
            return(View(order));
        }
        public async Task <IActionResult> Create([Bind("Id,ComboName,ComboDetails,TotalCost,Price,IdCatalog,DateCreated")] Combo combo)
        {
            if (ModelState.IsValid)
            {
                context.Add(combo);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCatalog"] = new SelectList(context.Catalogs, "Id", "CatalogDetails", combo.IdCatalog);
            return(View(combo));
        }
        public async Task <IActionResult> Create([Bind("Id,ProductName,Amount,Price,Detail,IdClassify,DateCreated")] Product product)
        {
            if (ModelState.IsValid)
            {
                context.Add(product);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdClassify"] = new SelectList(context.Classifies, "Id", "ClassifyDetail", product.IdClassify);
            return(View(product));
        }