public async Task <IActionResult> UpdateAsync(string uuid, [FromBody] ActorUpdateRequest actorUpdate) { var customerId = _membership.GetCustomerId(User); var actors = await _persistence.EventEntries.GetEventActorsByUUIDAsync(customerId, uuid); if (actors.Any(a => a.IsForgotten)) { return(NoContent()); } else if (actors.Count == 0) { return(NotFound(new ApiError(404, "Actor not found"))); } var actor = await _persistence.EventEntries.UpdateEventActorAsync(customerId, uuid, actorUpdate.Name, actorUpdate.Email); var response = new ActorQueryResponse() { Actors = new List <Actor> { new Actor(actor.UUID, actor.Name, actor.Email, actor.IsForgotten) } }; return(Ok(response)); }
public ActorUpdateResponse Update(ActorUpdateRequest request) { var response = new ActorUpdateResponse(); var repoActor = _session.Get <en.Actor>(request.Id); repoActor.FirstName = request.FirstName; repoActor.LastName = request.LastName; repoActor.LastUpdate = DateTime.UtcNow; try { _actorRepository.Update(repoActor); response.CompletedAt = DateTime.UtcNow; } catch (Exception ex) { response.ErrorMessage = $"Could not update Actor {ex.Message}"; } return(response); }