示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("RecordId,Name,ReleasedYear,NrOfTunes,TotalLength,Created,ArtistId")] Record record)
        {
            if (id != record.RecordId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(record);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RecordExists(record.RecordId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistId"] = new SelectList(_context.Artists, "ArtistId", "Name", record.ArtistId);
            return(View(record));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Name,RentedWhen,RecordId")] User user)
        {
            if (id != user.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RecordId"] = new SelectList(_context.Records, "RecordId", "Name", user.RecordId);
            return(View(user));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("ArtistId,UserName,Country,Provence,City,WebSite,CreatedDate")] 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)));
            }
            return(View(artist));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ArtistSkillId,TalentName,SkillLevel,Details,Styles")] ArtistSkill artistSkill)
        {
            if (id != artistSkill.ArtistId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(artistSkill);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArtistSkillExists(artistSkill.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(artistSkill));
        }
 public void UpdateArtist(ArtistDTO artistDTO)
 {
     var artist = fromDto(artistDTO, true);
     _artistContext.Update(artist);
 }