public async Task <IActionResult> AddVenue(Venue newVenue, string returnUrl, string queryString)
        {
            if (ModelState.IsValid)
            {
                await venuesService.AddVenue(newVenue);
            }

            return(RedirectToTheSamePage(returnUrl, queryString));
        }
示例#2
0
        public ActionResult CreateVenue([FromBody] CreateVenueVM createModel)
        {
            if (createModel == null)
            {
                return(BadRequest());
            }
            if (!ModelState.IsValid)
            {
                return(UnprocessableEntity(ModelState));
            }

            var venue = mapper.AutoMap <CreateVenueVM, Venue>(createModel);

            venuesService.AddVenue(venue);

            var model = mapper.AutoMap <Venue, VenueVM>(venue);

            return(CreatedAtAction(nameof(CreateVenue), model));
        }