public async Task <IActionResult> Create([Bind("Id,Name,Description")] InventoryItemCategory inventoryItemCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inventoryItemCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(inventoryItemCategory));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,SingularName,PluralName")] UnitOfMeasure unitOfMeasure)
        {
            if (ModelState.IsValid)
            {
                _context.Add(unitOfMeasure);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(unitOfMeasure));
        }
        public async Task <IActionResult> Create([Bind("Id,Url,Caption")] InventoryItemPhoto inventoryItemPhoto)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inventoryItemPhoto);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(inventoryItemPhoto));
        }
        public async Task <IActionResult> Create([Bind("Id,Content,ProductId,IdentityUserId")] UserComment userComment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userComment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdentityUserId"] = new SelectList(_context.Users, "Id", "Id", userComment.IdentityUserId);
            ViewData["ProductId"]      = new SelectList(_context.Products, "Id", "Id", userComment.ProductId);
            return(View(userComment));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Price,PrimaryPhotoId,UnitOfMeasureId,InventoryItemCategoryId")] InventoryItem inventoryItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inventoryItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InventoryItemCategoryId"] = new SelectList(_context.InventoryItemCategories, "Id", "Name", inventoryItem.InventoryItemCategoryId);
            ViewData["PrimaryPhotoId"]          = new SelectList(_context.InventoryItemPhotos, "Id", "Url", inventoryItem.PrimaryPhotoId);
            ViewData["UnitOfMeasureId"]         = new SelectList(_context.UnitsOfMeasure, "Id", "SingularName", inventoryItem.UnitOfMeasureId);
            return(View(inventoryItem));
        }