public async Task <IActionResult> Edit(int id, [Bind("ID,Street1,Street2,City,State,ZipCode,Neighborhood,SalesPrice,DateListed,Bedrooms,Bathrooms,GarageSize,SquareFeet,LotSize,Description")] Property @property)
        {
            if (id != @property.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@property);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropertyExists(@property.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@property));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ImageData,PropertyId")] Photo photo)
        {
            if (id != photo.ID)
            {
                return(NotFound());
            }

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