public async Task <PhysicalPersonModel> AddAsync(PhysicalPersonModel element, object IdUsuario)
        {
            try
            {
                var result = await _personRepository.AddAsync(_personMapper.Map(element), IdUsuario);

                return(_personMapper.Map(result));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public async Task <TransportEntity> AddPhysicalPerson(AddPhysicalPersonCommand PhysicalPerson)
        {
            try
            {
                PhysicalPerson physicalPerson = new PhysicalPerson()
                {
                    Name              = PhysicalPerson.Name,
                    Birthdate         = PhysicalPerson.Birthday,
                    Documents         = PhysicalPerson.Documents.ToList(),
                    InternetAddresses = PhysicalPerson.InternetAddresses.ToList()
                };

                ObjReturn.Sucess = true;
                ObjReturn.Data   = await PhysicalPersonRepository.AddAsync(physicalPerson);

                return(ObjReturn);
            }
            catch (Exception ex)
            {
                ObjReturn.Sucess = false;
                ObjReturn.Messages.Add(ex.Message);
                return(ObjReturn);
            }
        }