예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Passport,Year,Id,Education")] Employer employer)
        {
            if (id != employer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployerExists(employer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employer));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CountryId")] City city)
        {
            if (id != city.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityExists(city.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Name", city.CountryId);
            return(View(city));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Year,Budget,ItCompanyId,Id")] Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ItCompanyId"] = new SelectList(_context.ItCompanies, "Id", "Name", product.ItCompanyId);
            return(View(product));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CityId,Square,Address,ItCompanyId")] Office office)
        {
            if (id != office.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(office);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OfficeExists(office.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"]      = new SelectList(_context.Cities, "Id", "Name", office.CityId);
            ViewData["ItCompanyId"] = new SelectList(_context.ItCompanies, "Id", "Name", office.ItCompanyId);
            return(View(office));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Salary,PositionId,SubdivisionId,EmployerId")] EmpSub empSub)
        {
            if (id != empSub.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(empSub);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmpSubExists(empSub.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployerId"]    = new SelectList(_context.Employers, "Id", "Name", empSub.EmployerId);
            ViewData["PositionId"]    = new SelectList(_context.Positions, "Id", "Position", empSub.PositionId);
            ViewData["SubdivisionId"] = new SelectList(_context.Subdivisions, "Id", "Name", empSub.SubdivisionId);
            return(View(empSub));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,OfficeId")] Subdivision subdivision)
        {
            if (id != subdivision.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subdivision);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubdivisionExists(subdivision.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OfficeId"] = new SelectList(_context.Offices, "Id", "Address", subdivision.OfficeId);
            return(View(subdivision));
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Country country)
        {
            if (id != country.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
예제 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Year,Id")] ItCompany itCompany)
        {
            if (id != itCompany.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(itCompany);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItCompanyExists(itCompany.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(itCompany));
        }