Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }