Beispiel #1
0
        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));
        }
Beispiel #2
0
        public async Task <IActionResult> GetAsync(string uuid)
        {
            var customerId = _membership.GetCustomerId(User);
            var actors     = await _persistence.EventEntries.GetEventActorsByUUIDAsync(customerId, uuid);

            var response = new ActorQueryResponse()
            {
                Actors = actors.Select(a => new Actor(a.UUID, a.Name, a.Email, a.IsForgotten)).Distinct().ToList()
            };

            return(Ok(response));
        }
Beispiel #3
0
        public async Task <IActionResult> ForgetAsync(string uuid)
        {
            var customerId = _membership.GetCustomerId(User);
            var actors     = await _persistence.EventEntries.GetEventActorsByUUIDAsync(customerId, uuid);

            if (actors.Count == 0)
            {
                return(NotFound(new ApiError(404, "Actor not found")));
            }

            var actor = await _persistence.EventEntries.ForgetEventActorAsync(customerId, uuid);

            var response = new ActorQueryResponse()
            {
                Actors = new List <Actor> {
                    new Actor(actor.UUID, actor.Name, actor.Email, actor.IsForgotten)
                }
            };

            return(Ok(response));
        }