public IActionResult PostV11([FromBody] CreateFoodTruckModelV11 createModel) { var createCommand = this.mapper.Map <CreateFoodTruckModelV11, CreateFoodTruckCommand>(createModel); FoodTruck foodTruck = this.foodTruckService.CreateFoodTruck(createCommand); var model = this.mapper.Map <FoodTruck, FoodTruckModelV11>(foodTruck); return(this.CreatedAtRoute(GET_FOOD_TRUCK_BY_ID, new { id = model.FoodTruckId }, model)); }
public ActionResult <FoodTruckModelV11> PostV11([FromBody] CreateFoodTruckModelV11 createModel) { var createCommand = _mapper.Map <CreateFoodTruckModelV11, CreateFoodTruckCommand>(createModel); var result = _foodTruckService.CreateFoodTruck(createCommand); if (result.IsSuccess) { var model = _mapper.Map <FoodTruck, FoodTruckModelV11>(result.Value); return(CreatedAtRoute(GET_FOOD_TRUCK_BY_ID, new { id = model.FoodTruckId }, model)); } else { return(MapErrorResult <FoodTruck, FoodTruckModelV11>(result)); } }