Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ArtistID,Name,MembersCount,Genre,City,RegistrationDate")] Artist artist)
        {
            if (id != artist.ArtistID)
            {
                return(View("NotFound"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    NameHelper.ArtistFixedNames(artist);
                    _context.Update(artist);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await ArtistExists(artist.ArtistID))
                    {
                        return(View("NotFound"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View("Edit", artist));
        }
Exemplo n.º 2
0
 public async Task <IActionResult> Create([Bind("ArtistID,Name,MembersCount,Genre,City,RegistrationDate")] Artist artist)
 {
     if (ModelState.IsValid)
     {
         NameHelper.ArtistFixedNames(artist);
         _context.Add(artist);
         return(RedirectToAction(nameof(Index)));
     }
     return(View("Create", artist));
 }