public ActionResult Edit(EditPlateModelView modelView)
        {
            var plate = new Plate
            {
                Id           = modelView.Id,
                Name         = modelView.NamePlate,
                RestaurantId = modelView.RestaurantId,
                Ingredients  = modelView.Ingredients
            };

            if (_plateRepository.Update(plate))
            {
                return(RedirectToAction("Index"));
            }

            return(View(modelView));
        }
Beispiel #2
0
        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);
        }