public IActionResult Create(Person person)
        {
            try
            {
                if (person == null)
                {
                    return(BadRequest());
                }

                _personAppService.Add(person);

                if (IsValidOperation())
                {
                    return(Created(string.Format("api/person/{0}", person.Id), person));
                }

                var errors = string.Join(',', _notifications.GetNotifications().Select(n => n.Value).ToArray());

                return(NotFound(errors));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest("Error while processing your request!"));
            }
        }
Exemplo n.º 2
0
        public IActionResult CreatePerson([FromBody] Models.Person person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var personEntity = Mapper.Map <Domain.Entities.Person>(person);



            _personAppService.Add(personEntity);

            return(Ok());
        }
 public IActionResult Post([FromBody] PersonModel person)
 {
     return(new ObjectResult(_personAppService.Add(person)));
 }
Exemplo n.º 4
0
 public void Post([FromBody] PersonViewModel personViewModel)
 {
     _personAppService.Add(personViewModel);
 }