public Task <HttpResponseMessage> Create([FromBody] dynamic body)
        {
            var command = new CreatePlateCommand(
                plateName: (string)body.plateName,
                price: (decimal)body.price,
                restaurantId: (int)body.restaurantId
                );

            var plate = _service.Create(command);

            return(CreateResponse(HttpStatusCode.Created, plate));
        }
Beispiel #2
0
        public Plate Create(CreatePlateCommand command)
        {
            var plate = new Plate(command.PlateName, command.Price, command.RestaurantId);

            plate.Create();
            _repository.Create(plate);

            if (Commit())
            {
                return(plate);
            }

            return(null);
        }