Exemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,CityId,MunicipalityId,Address1,City,Zip")] Address address)
        {
            if (id != address.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(address);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AddressExists(address.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,Position,MunicipalityId")] Official official)
        {
            if (id != official.Id)
            {
                return(NotFound());
            }

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