示例#1
0
        public async Task <IActionResult> Create([Bind("Id,Code,Name,Address,City,State,Zip,Phone,Email")] Vendor vendor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vendor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendor));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Username,Password,Firstname,Lastname,Phone,Email,IsReviewer,IsAdmin")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("Id,Description,Justification,RejectionReason,DeliveryMode,Status,Total,UserId")] Request request)
        {
            if (ModelState.IsValid)
            {
                _context.Add(request);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Firstname", request.UserId);
            return(View(request));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("Id,PartNbr,Name,Price,Unit,Photopath,VendorId")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VendorId"] = new SelectList(_context.Vendors, "Id", "Address", product.VendorId);
            return(View(product));
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("Id,RequestId,ProductId,Quantity")] RequestLine requestLine)
        {
            if (ModelState.IsValid)
            {
                _context.Add(requestLine);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", requestLine.ProductId);
            ViewData["RequestId"] = new SelectList(_context.Requests, "Id", "DeliveryMode", requestLine.RequestId);
            return(View(requestLine));
        }