public ActionResult Edit(Artist item) { try { if (User.IsInRole("Admin")) { if (ModelState.IsValid) { if (item.ArtistId > 0) { var updatedRecord = _repo.Update(item); if (updatedRecord.ArtistId < 1) { return(RedirectToAction("Error404", "Home")); } return(RedirectToAction("Index", "Artists")); } } } return(RedirectToAction("Login", "Account")); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.ToString())); } }
public async Task <IActionResult> Update(int id, [FromBody] ArtistToCreateDto artistDto) { var mappedArtist = _mapper.Map <Artist>(artistDto); _artistRepo.Update(id, mappedArtist); await _artistRepo.SaveChangesAsync(); var updatedArtist = await _artistRepo.GetByIdAsync(id); var mappedUpdatedArtist = _mapper.Map <ArtistDto>(updatedArtist); return(Ok(_linkService.CreateLinks(mappedUpdatedArtist))); }
public Artist UpdateArtist(List <string> parameteres) { return(_artistRepo.Update(new Artist(long.Parse(parameteres[0]), parameteres[1], parameteres[2]))); }