public IActionResult Post([FromBody] CreateLocationModel createModel) { var createLocationCommand = this.mapper.Map <CreateLocationModel, CreateLocationCommand>(createModel); Location location = this.locationService.CreateLocation(createLocationCommand); var model = this.mapper.Map <Location, LocationModel>(location); return(this.CreatedAtRoute("GetLocationById", new { id = location.LocationId }, model)); }
public IActionResult Post([FromBody] CreateLocationModel createModel) { var createLocationCommand = _mapper.Map <CreateLocationModel, CreateLocationCommand>(createModel); var result = _locationService.CreateLocation(createLocationCommand); return(CreateResponse <Location, LocationModel>(result, (entity) => { var model = _mapper.Map <Location, LocationModel>(entity); return CreatedAtRoute("GetLocationById", new { id = entity.LocationId }, model); })); }