예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Title,Content,ImageURL,Author,PublishDate,IsDraft")] News news)
        {
            if (ModelState.IsValid)
            {
                _context.Add(news);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(news));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,Author,Content,Price,PriceEBook,PriceAudiobook,IdCategory,ImageURL,Rating,IsFeatured")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,CreatedAt,Login,FirstName,LastName,Address,Sum")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,Title,Content,IdParentCategory")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }