public async Task <IActionResult> Create([Bind("ContractorId,NameCompany")] Contractor contractor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contractor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(contractor));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("LicenseId,DateIssue,Number,ValidityYear")] License license)
        {
            if (ModelState.IsValid)
            {
                _context.Add(license);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(license));
        }
        public async Task <IActionResult> Create([Bind("CustomerId,CompanyName,NameCeo,SurnameCeo")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("ManufacturerId,ManufacturerName")] Manufacturer manufacturer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(manufacturer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(manufacturer));
        }
        public async Task <IActionResult> Create([Bind("TechnicalEquipmentId,Denotation,Appointment,DatePurchase,LifetimeYear,ContractorId")] TechnicalEquipment technicalEquipment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(technicalEquipment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "ContractorId", "NameCompany", technicalEquipment.ContractorId);
            return(View(technicalEquipment));
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("BuildingMaterialId,NameMaterial,ManufacturerId,VolumePurchaseQuantity,ContractorId")] BuildingMaterial buildingMaterial)
        {
            if (ModelState.IsValid)
            {
                _context.Add(buildingMaterial);
                await _context.SaveChangesAsync();

                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> Create([Bind("TypesJobId,Name,LicenseId,ContractorId,Price")] TypesJob typesJob)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typesJob);
                await _context.SaveChangesAsync();

                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 #8
0
        public async Task <IActionResult> Create([Bind("ListWorkId,TypesJobId,MainObjectId")] ListWork listWork)
        {
            if (ModelState.IsValid)
            {
                _context.Add(listWork);
                await _context.SaveChangesAsync();

                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 #9
0
        public async Task <IActionResult> Create([Bind("MainObjectId,NameObject,CustomerId,ContractorId,ConclusionContract,DeliveryObject,DateInputObject")] MainObject mainObject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mainObject);
                await _context.SaveChangesAsync();

                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));
        }