Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,CreateDate,Price,Genre,AddInfo,IdArtist,IdTechnique,Url,Id")] Picture picture)
        {
            if (id != picture.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(picture);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PictureExists(picture.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdArtist"]    = new SelectList(_context.Artists, "Id", "Name", picture.IdArtist);
            ViewData["IdTechnique"] = new SelectList(_context.Techniques, "Id", "Name", picture.IdTechnique);
            return(View(picture));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,LastName,Bday,Death,ArtDirection,Telephone,IdCity,Surname,Url,AddInfo,Id")] Artist artist)
        {
            if (id != artist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(artist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArtistExists(artist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCity"] = new SelectList(_context.Cities, "Id", "Name", artist.IdCity);
            return(View(artist));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdCurrExh,IdPicture,Room,Id")] ExhibitedPicture exhibitedPicture)
        {
            if (id != exhibitedPicture.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exhibitedPicture);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExhibitedPictureExists(exhibitedPicture.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCurrExh"] = new SelectList(_context.CurrentExhibitions, "Id", "Name", exhibitedPicture.IdCurrExh);
            ViewData["IdPicture"] = new SelectList(_context.Pictures, "Id", "Name", exhibitedPicture.IdPicture);
            return(View(exhibitedPicture));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Price,Description,Thumbnail,Id")] Exhibition exhibition)
        {
            if (id != exhibition.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exhibition);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExhibitionExists(exhibition.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exhibition));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Surname,Name,LastName,Bday,Job,Telephone,IdCity,AddInfo,Id")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCity"] = new SelectList(_context.Cities, "Id", "Name", employee.IdCity);
            return(View(employee));
        }