public async Task <IActionResult> IsAcssept(long?id, AcceptedTypes AccessTypeId, string Reason)
        {
            var product = await _context.Products.FindAsync(id);

            if (product == null)
            {
                return(NotFound());
            }


            if (ModelState.IsValid)
            {
                try
                {
                    product.IsAccepted = AccessTypeId;
                    product.Reason     = Reason;
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            ViewData["CorroborantId"] = new SelectList(_context.Corroborants, "Id", "Id", product.CorroborantId);
            ViewData["ProductTypeId"] = new SelectList(_context.ProductTypes, "Id", "Id", product.ProductTypeId);
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name")] LicenseType licenseType)
        {
            if (id != licenseType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(licenseType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LicenseTypeExists(licenseType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(licenseType));
        }
Пример #3
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,RecordNumber,RecordDate,RecordPlace,CompanyStartDate,FactoryStartDate,FactoryUseDate,NationalId,EconomicCode,UseLicenseNumber,UseLicenseDate,ActivityDescription,MaterialList,Randd,ConstructionMetod,QcProgram,ResearchMember,UploadUseLicensePic,UploadStatutePic,UploadOfficialnewspapers,UploadProductCatalog,UploadDocuments,UploadMemberOfTheInstitute,CompanyTypeId,OwnershipTypeId,CarId,LicenseId")] Company company)
        {
            if (id != company.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["CarId"] = new SelectList(_context.Cars, "Id", "Id", company.Car.Id);
            ViewData["CompanyTypeId"]   = new SelectList(_context.CompanyTypes, "Id", "Id", company.CompanyType.Id);
            ViewData["LicenseId"]       = new SelectList(_context.Licenses, "Id", "Id", company.License.Id);
            ViewData["OwnershipTypeId"] = new SelectList(_context.OwnershipType, "Id", "Id", company.OwnershipType.Id);
            return(View(company));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Family,FatherName,NationalCode,IDNumber,BirthDate,DegreeEducation,Tel,Fax,Email,Post,WorkExperience,TheSignatory,CustomerTypeId,UserId")] Customer customer)
        {
            if (id != customer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerTypeId"] = new SelectList(_context.CustomerTypes, "Id", "Id", customer.CustomerTypeId);
            return(View(customer));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,StartDate,EndDate,UploadLinces,LicenseTypeId,UserId")] License license)
        {
            if (id != license.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(license);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LicenseExists(license.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LicenseTypeId"] = new SelectList(_context.LicenseTypes, "Id", "Id", license.LicenseTypeId);
            return(View(license));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Year,Amount,ProductId,UserId")] ProductionRate productionRate)
        {
            if (id != productionRate.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productionRate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionRateExists(productionRate.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Id", productionRate.ProductId);
            return(View(productionRate));
        }
Пример #7
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name")] ManufacturingGroup manufacturingGroup)
        {
            if (id != manufacturingGroup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(manufacturingGroup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ManufacturingGroupExists(manufacturingGroup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(manufacturingGroup));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,UploadLinces,CorroborantTypeId,Name")] Corroborant corroborant,
                                               IFormFile UploadLinces, string startdate, string enddate)
        {
            DateTime sdate = Convert.ToDateTime(startdate);
            DateTime edate = Convert.ToDateTime(enddate);

            if (id != corroborant.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    corroborant.StartDate = sdate;
                    corroborant.EndDate   = edate;
                    _context.Update(corroborant);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CorroborantExists(corroborant.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CorroborantTypeId"] = new SelectList(_context.CorroborantTypes, "Id", "Name");

            return(View(corroborant));
        }