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!")); } }
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))); }
public void Post([FromBody] PersonViewModel personViewModel) { _personAppService.Add(personViewModel); }