public async Task <IActionResult> Edit(string id, EditActorInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } await this.actorsService.EditActorAsync(input); return(this.RedirectToAction(nameof(this.Details), new { id = input.Id })); }
public async Task EditActorAsync(EditActorInputModel input) { var actor = await this.actorsRepository.GetByIdWithDeletedAsync(input.Id); actor.ImageUrl = input.ImageUrl; actor.Info = input.Info; actor.FirstName = input.FirstName; actor.LastName = input.LastName; var genderAsEnum = Enum.Parse <Gender>(input.Gender); actor.Gender = genderAsEnum; actor.BirthDate = input.BirthDate; this.actorsRepository.Update(actor); await this.actorsRepository.SaveChangesAsync(); }