public Task <HttpResponseMessage> Update([FromBody] dynamic body) { var command = new UpdatePlateCommand( plateId: (int)body.plateId, plateName: (string)body.plateName, price: (decimal)body.price, restaurantId: (int)body.restaurantId ); var plate = _service.Update(command); return(CreateResponse(HttpStatusCode.Created, plate)); }
public Plate Update(UpdatePlateCommand command) { var plate = _repository.GetById(command.PlateId, command.RestaurantId); if (plate == null) { return(null); } plate.Update(command.PlateName, command.Price, command.RestaurantId); _repository.Update(plate); if (Commit()) { return(plate); } return(null); }