public async Task <PersonDTO> PutAsync(PersonCreateDTO Person)
        {
            this.Logger.LogTrace($"{nameof(this.PutAsync)} called");

            var result = await this.PersonCreateService.CreateAsync(this.Mapper.Map <PersonUpdateModel>(Person));

            return(this.Mapper.Map <PersonDTO>(result));
        }
Esempio n. 2
0
        //CREATE PERSON
        public async Task <bool> CreatePerson(PersonCreateDTO dto)
        {
            var rao = _mapper.Map <PersonCreateRAO>(dto);

            if (await _repository.CreatePerson(rao))
            {
                return(true);
            }

            throw new NotImplementedException();
        }
Esempio n. 3
0
 public IActionResult Create([FromBody] PersonCreateDTO personCreateCommand)
 {
     try
     {
         _personService.Handle(personCreateCommand);
         return(Ok());
     }
     catch (System.Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Esempio n. 4
0
        public ActionResult <PersonCreateDTO> PersonRegister(PersonCreateDTO facu)
        {
            try
            {
                //var facultyModel = _mapper.Map<Faculty>(facu);

                return(Ok(SqlPersonsRepository.PersonRegister(facu.dni, facu.first_name, facu.last_name)));
            }
            catch (DatabaseException)
            {
                return(StatusCode(500));
            }
        }
        public ActionResult <PersonReadDTO> CreatePerson(PersonCreateDTO personCreateDTO)
        {
            var Person = _mapper.Map <Person>(personCreateDTO);

            Person.Id = new Guid();

            _PersonRepo.CreatePerson(Person);
            _PersonRepo.SaveChanges();
            // sends location and 201 status with header
            return(CreatedAtRoute(nameof(GetPersonById), new { Id = Person.Id }, personCreateDTO));
            // sends 200 status only
            // return Ok(_mapper.Map<PersonReadDTO>(_PersonRepo.GetPersonById(Person.Id)));
        }