Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdMaterial,MaterialName,MaterialType,QuantityMaterialInStock")] Material material)
        {
            if (id != material.IdMaterial)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(material);
                    await _context.SaveChangesAsync();

                    _cachedService.RefreshMaterials();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialExists(material.IdMaterial))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(material));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("MaterialSuplyId,Provider,MaterialId,PriceOfMaterials,AmountOfMaterial,DeliveryDate")] MaterialSupply materialSupply)
        {
            if (id != materialSupply.MaterialSuplyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(materialSupply);
                    await _context.SaveChangesAsync();

                    _cachedService.RefreshMaterialSupplys();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialSupplyExists(materialSupply.MaterialSuplyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaterialId"] = new SelectList(_context.Materials, "IdMaterial", "MaterialName", materialSupply.MaterialId);
            return(View(materialSupply));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdDepartment,DepartmentName,AmountOfWorkers,DescriptionOfTheTypeOfWork")] AtelierDepartment atelierDepartment)
        {
            if (id != atelierDepartment.IdDepartment)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(atelierDepartment);
                    await _context.SaveChangesAsync();

                    _cachedService.RefreshAtelierDepartments();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AtelierDepartmentExists(atelierDepartment.IdDepartment))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            _cachedService.RefreshAtelierDepartments();
            return(View(atelierDepartment));
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IdProduct,ProductName,MaterialNameId,NumberOfMaterialsPerItem,ProductPrice")] Product product)
        {
            if (id != product.IdProduct)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();

                    _cachedService.RefreshProducts();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.IdProduct))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaterialNameId"] = new SelectList(_context.Materials, "IdMaterial", "MaterialName", product.MaterialNameId);
            return(View(product));
        }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("IdOrder,CustomerName,ProductNameID,EmployeeID,NumberOfProducts,Price,OrderDate,CheckSaleDate")] Order order)
        {
            if (id != order.IdOrder)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();

                    _cachedService.RefreshOrders();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.IdOrder))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"]    = new SelectList(_context.Products, "IdEmployee", "FullName", order.EmployeeID);
            ViewData["ProductNameID"] = new SelectList(_context.Products, "IdProduct", "ProductName", order.ProductNameID);
            return(View(order));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdEmployee,FullName,DepartmentId,Position,Telephone")] Employee employee)
        {
            if (id != employee.IdEmployee)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();

                    _cachedService.RefreshEmployees();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.IdEmployee))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentId"] = new SelectList(_context.AtelierDepartments, "IdDepartment", "DepartmentName", employee.DepartmentId);

            return(View(employee));
        }