예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Parent,Slug,Status,CreatedAt,UpdatedAt")] Categorys categorys)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categorys);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorys));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,CatId,NameLap,Title,Description,Price,Quantity,Size,Weight,Color,Image,Memory,Os,CpuSpeed,Camera,Battery,Waranty,Bluetooth,Wlan,SalePrice,StartPromotion,EndPromotion,CreatedAt,UpdatedAt")] Laptop laptop)
        {
            if (ModelState.IsValid)
            {
                _context.Add(laptop);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CatId"] = new SelectList(_context.Categorys, "Id", "Name", laptop.CatId);
            return(View(laptop));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,LaptopId,FullName,CommentTime,CommentContent,PhoneNumber")] Comment comment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LaptopId"] = new SelectList(_context.Laptop, "Id", "NameLap", comment.LaptopId);
            return(View(comment));
        }