Exemplo n.º 1
0
        public string AddActor(AddPerson actor)
        {
            var checkExists = _personRepository.GetPerson(actor.Name, PersonType.Actor);

            if (checkExists != null)
            {
                return(ErrorMessages.ACTOR_ALREADY_EXISTS);
            }

            var result = ValidatePersonForAdd(actor.Name, actor.Sex, actor.Bio, actor.DOB);

            if (string.IsNullOrEmpty(result))
            {
                var newActor = _personRepository.AddActor(actor);
                if (newActor != null)
                {
                    return(newActor.Id.ToString());
                }
                else
                {
                    return(ErrorMessages.SERVER_ERROR);
                }
            }
            else
            {
                return(result);
            }
        }