コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,ThumbnailTemp,Keywords")] StandardParent standardParent)
        {
            if (ModelState.IsValid)
            {
                _context.Add(standardParent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(standardParent));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Thumbnail")] Application application)
        {
            if (ModelState.IsValid)
            {
                _context.Add(application);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(application));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Features,Specification,TempThumbnail,BrandId")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandId"] = new SelectList(_context.Brand, "Id", "Id", product.BrandId);
            return(View(product));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,ThumbnailTemp,ParentId")] Standard standard)
        {
            if (ModelState.IsValid)
            {
                _context.Add(standard);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ParentId"] = new SelectList(_context.StandardParent, "Id", "Id", standard.ParentId);
            return(View(standard));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,ProductId,CategoryId")] CategoryLink categoryLink)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categoryLink);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Id", categoryLink.CategoryId);
            ViewData["ProductId"]  = new SelectList(_context.Product, "Id", "Id", categoryLink.ProductId);
            return(View(categoryLink));
        }