Ejemplo n.º 1
0
        public async Task <IActionResult> PostAsync([FromBody] OrganizerResource resource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            var organzier = _mapper.Map <OrganizerResource, Organizer>(resource);
            var result    = await _organizerService.SaveAsync(organzier);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var organizerResource = _mapper.Map <Organizer, OrganizerResource>(result.Organizer);

            return(Ok(organizerResource));
        }