Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Trade,CompanyEmail,Street,Town,PostalCode,Voivodeship,Country,OwnerID")] Company company)
        {
            if (id != company.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(CompanyMapper.MapCompanyToView(company, _context));
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(company));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var company = await _context.Companies.SingleOrDefaultAsync(m => m.ID == id);

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

            PrepareVoivodeshipsAndCountires();
            return(View(CompanyMapper.MapCompanyToView(company, _context)));
        }
Esempio n. 3
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var company = await _context.Companies
                          .SingleOrDefaultAsync(m => m.ID == id);

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

            return(View(CompanyMapper.MapCompanyToView(company, _context)));
        }