public void CreatePerson(CreatePersonInput input)
 {
     person = new Person {
         Name = input.Name, EmailAddress = input.EmailAddress
     };
     _personRepository.Insert(person);
 }
Example #2
0
        public void CreatePerson(CreatePersonInput input)
        {
            Person person = new Person
            {
                Name = input.Name
            };

            person = _personRepository.Insert(person);
        }
        public async Task CreatePerson(CreatePersonInput input)
        {
            //if (await FeatureChecker.IsEnabledAsync("CreatePerson"))
            //{
            //    throw new AbpAuthorizationException("You don't have this feature: CreatePerson");
            //}

            var person = ObjectMapper.Map <Person>(input);
            await _personRepository.InsertAsync(person);
        }
        public CreatePersonOutput CreatePerson(CreatePersonInput input)
        {
            var person = Mapper.Map <Person>(input);

            _personRepository.InsertAndGetId(person);

            return(new CreatePersonOutput
            {
                Person = Mapper.Map <PersonDto>(person)
            });
        }
        //private IRepository<Person> _personRepository;

        ////constructor injection.
        ////PersonAppService does not know which classes implement IPersonRepository or how it is created.
        ////When an PersonAppService is needed, we first create an IPersonRepository and pass it to the constructor of the PersonAppService
        //public PersonAppService(IRepository<Person> personRepository)
        //{
        //    _personRepository = personRepository;
        //}

        public void CreatePerson(CreatePersonInput input)
        {
            //    Logger.Debug("IChecking if person excists with email address...");
            //    var person = _personRepository.FirstOrDefault(p => p.EmailAdress == input.EmailAddress);
            //    if (person != null)
            //    {
            //        throw new UserFriendlyException("There is already a person with given email address");
            //    }
            //    Logger.Debug("Inserting a new person with email address" + input.EmailAddress);
            //    person = new Person{ Name = input.Name, EmailAddress = input.EmailAddress };
            //    _personRepository.Insert(person);
            //    Logger.Debug("Person succefully added");
        }
        public async Task <CreatePersonPayload> CreatePersonAsync(
            [Service] IMongoCollection <Person> collection,
            CreatePersonInput input)
        {
            var person = new Person()
            {
                Name        = input.Name,
                Addresses   = input.Addresses,
                MainAddress = input.MainAddress
            };

            await collection.InsertOneAsync(person);

            return(new CreatePersonPayload(person));
        }
Example #7
0
 public async Task CreatePerson(CreatePersonInput input)
 {
     var person = input.MapTo <Person>();
     await _personRepository.InsertAsync(person);
 }
Example #8
0
 public ActionResult Create(CreatePersonInput input)
 {
     _personAppService.CreatePerson(input);
     return(Content("ok"));
 }
Example #9
0
 public async Task CreatePersonAsync(CreatePersonInput input)
 {
     await _personRepository.InsertAsync(input.MapTo <Person>());
 }
Example #10
0
 //Para poner permisos a un metodo
 //  [AbpAuthorize(PermissionNames.Pages_Tenant_PhoneBook_CreatePerson)]
 public async Task CreatePerson(CreatePersonInput input)
 {
     var person = ObjectMapper.Map <Person>(input);
     await _personRepository.InsertAsync(person);
 }
Example #11
0
 internal static object MapTo <T>(CreatePersonInput input)
 {
     throw new NotImplementedException();
 }
Example #12
0
 public async Task CreatePersonAsync(CreatePersonInput input)
 {
     await personRepository.InsertAsync(ObjectMapper.Map <Person>(input));
 }
Example #13
0
        public int CreatePerson(CreatePersonInput dto)
        {
            var entity = Mapper.Map <Person>(dto);

            return(_personRepository.InsertAndGetId(entity));
        }
Example #14
0
        public object Post(CreatePersonInput input)
        {
            var result = _service.CreatePerson(input);

            return(new { Id = result });
        }
Example #15
0
 public Task CreatePerson(CreatePersonInput input)
 {
     throw new NotImplementedException();
 }