public async Task <IActionResult> Create([Bind("IdMaterial,MaterialName,MaterialType,QuantityMaterialInStock")] Material material) { if (ModelState.IsValid) { _context.Add(material); await _context.SaveChangesAsync(); _cachedService.RefreshMaterials(); return(RedirectToAction(nameof(Index))); } return(View(material)); }
public async Task <IActionResult> Create([Bind("IdDepartment,DepartmentName,AmountOfWorkers,DescriptionOfTheTypeOfWork")] AtelierDepartment atelierDepartment) { if (ModelState.IsValid) { _context.Add(atelierDepartment); await _context.SaveChangesAsync(); _cachedService.RefreshAtelierDepartments(); return(RedirectToAction(nameof(Index))); } return(View(atelierDepartment)); }
public async Task <IActionResult> Create([Bind("MaterialSuplyId,Provider,MaterialId,PriceOfMaterials,AmountOfMaterial,DeliveryDate")] MaterialSupply materialSupply) { if (ModelState.IsValid) { _context.Add(materialSupply); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MaterialId"] = new SelectList(_context.Materials, "IdMaterial", "MaterialName", materialSupply.MaterialId); _cachedService.RefreshMaterialSupplys(); return(View(materialSupply)); }
public async Task <IActionResult> Create([Bind("IdProduct,ProductName,MaterialNameId,NumberOfMaterialsPerItem,ProductPrice")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MaterialNameId"] = new SelectList(_context.Materials, "IdMaterial", "MaterialName", product.MaterialNameId); _cachedService.RefreshOrders(); return(View(product)); }
public async Task <IActionResult> Create([Bind("IdEmployee,FullName,DepartmentId,Position,Telephone")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); _cachedService.RefreshEmployees(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.AtelierDepartments, "IdDepartment", "DepartmentName", employee.DepartmentId); return(View(employee)); }
public async Task <IActionResult> Create([Bind("IdOrder,CustomerName,ProductNameID,EmployeeID,NumberOfProducts,Price,OrderDate,CheckSaleDate")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeID"] = new SelectList(_context.Employees, "IdEmployee", "FullName", order.EmployeeID); ViewData["ProductNameID"] = new SelectList(_context.Products, "IdProduct", "ProductName", order.ProductNameID); _cachedService.RefreshOrders(); return(View(order)); }