public async Task <IActionResult> Create([Bind("Id,VendorId,PartNumber,Name,Price,Unit,PhotoPath,IsActive,DateCreated,DateUpdated,UpdatedByUser")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,Description,Justification,RejectionReason,DateNeeded,DeliveryMode,Status,Total,SubmittedDate,UserId")] PurchaseRequest purchaseRequest) { if (ModelState.IsValid) { _context.Add(purchaseRequest); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", purchaseRequest.UserId); return(View(purchaseRequest)); }