public async Task <IActionResult> Edit(int id, [Bind("TechnicalEquipmentId,Denotation,Appointment,DatePurchase,LifetimeYear,ContractorId")] TechnicalEquipment technicalEquipment)
        {
            if (id != technicalEquipment.TechnicalEquipmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(technicalEquipment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechnicalEquipmentExists(technicalEquipment.TechnicalEquipmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "ContractorId", "NameCompany", technicalEquipment.ContractorId);
            return(View(technicalEquipment));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("BuildingMaterialId,NameMaterial,ManufacturerId,VolumePurchaseQuantity,ContractorId")] BuildingMaterial buildingMaterial)
        {
            if (id != buildingMaterial.BuildingMaterialId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(buildingMaterial);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuildingMaterialExists(buildingMaterial.BuildingMaterialId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"]   = new SelectList(_context.Contractors, "ContractorId", "NameCompany", buildingMaterial.ContractorId);
            ViewData["ManufacturerId"] = new SelectList(_context.Manufacturers, "ManufacturerId", "ManufacturerName", buildingMaterial.ManufacturerId);
            return(View(buildingMaterial));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ContractorId,NameCompany")] Contractor contractor)
        {
            if (id != contractor.ContractorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contractor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractorExists(contractor.ContractorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contractor));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("LicenseId,DateIssue,Number,ValidityYear")] License license)
        {
            if (id != license.LicenseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(license);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LicenseExists(license.LicenseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(license));
        }
Beispiel #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ManufacturerId,ManufacturerName")] Manufacturer manufacturer)
        {
            if (id != manufacturer.ManufacturerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(manufacturer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ManufacturerExists(manufacturer.ManufacturerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(manufacturer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TypesJobId,Name,LicenseId,ContractorId,Price")] TypesJob typesJob)
        {
            if (id != typesJob.TypesJobId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typesJob);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypesJobExists(typesJob.TypesJobId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "ContractorId", "NameCompany", typesJob.ContractorId);
            ViewData["LicenseId"]    = new SelectList(_context.Licenses, "LicenseId", "Number", typesJob.LicenseId);
            return(View(typesJob));
        }
Beispiel #7
0
        public async Task <IActionResult> Edit(int id, [Bind("ListWorkId,TypesJobId,MainObjectId")] ListWork listWork)
        {
            if (id != listWork.ListWorkId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(listWork);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListWorkExists(listWork.ListWorkId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MainObjectId"] = new SelectList(_context.MainObjects, "MainObjectId", "NameObject", listWork.MainObjectId);
            ViewData["TypesJobId"]   = new SelectList(_context.TypesJobs, "TypesJobId", "Name", listWork.TypesJobId);
            return(View(listWork));
        }
Beispiel #8
0
        public async Task <IActionResult> Edit(int id, [Bind("MainObjectId,NameObject,CustomerId,ContractorId,ConclusionContract,DeliveryObject,DateInputObject")] MainObject mainObject)
        {
            if (id != mainObject.MainObjectId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mainObject);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MainObjectExists(mainObject.MainObjectId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "ContractorId", "NameCompany", mainObject.ContractorId);
            ViewData["CustomerId"]   = new SelectList(_context.Customers, "CustomerId", "CompanyName", mainObject.CustomerId);
            return(View(mainObject));
        }