private Clothes AddClothes(ClothesType type, decimal buyPrice, Sizes size, Colors color, int amount) { Clothes clothes = null; switch (type) { case ClothesType.DressShirt: clothes = new DressShirt() { SellPrice = 8, }; break; case ClothesType.TShirt: clothes = new TShirt() { SellPrice = 12 }; break; } if (clothes == null) { throw new Exception("Cannot determine the clothes type"); } clothes.Amount = amount; clothes.Id = Guid.NewGuid().ToString(); clothes.BuyPrice = buyPrice; clothes.Color = color; clothes.Size = size; DbContext.AddClothes(clothes); return(clothes); }