Пример #1
0
        public void UpdateShoe(ShoeModel shoe)
        {
            var shoeRecord = _repository.GetShoe(shoe.Id);

            shoeRecord.Color   = shoe.Color;
            shoeRecord.Brand   = shoe.Brand;
            shoeRecord.Style   = shoe.Style;
            shoeRecord.OwnerId = shoe.OwnerId;
            shoeRecord.IsPair  = shoe.IsPair;

            _repository.UpdateShoe(shoeRecord);
        }
Пример #2
0
        public Shoe UpdateShoe(Shoe updatedShoe)
        {
            if (string.IsNullOrEmpty(updatedShoe.ProductName))
            {
                throw new InvalidDataException("You can NOT create a shoe without a product name.");
            }

            if (updatedShoe.Price < 0)
            {
                throw new InvalidDataException("The price of a shoe can NOT be less than 0");
            }

            return(shoeRepo.UpdateShoe(updatedShoe));
        }