示例#1
0
        public List <InventoryUtility.Rice> AddToInventory(List <InventoryUtility.Rice> riceList)
        {
            InventoryUtility.Rice utility = new InventoryUtility.Rice();

            Console.WriteLine("enter Name of rice:");
            utility.Name = Console.ReadLine();
            Console.WriteLine("enter price of rice:");
            utility.Price = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("enter weight in kg of rice:");
            utility.Kg = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("enter type of rice:");
            utility.Type = Console.ReadLine();
            riceList.Add(utility);
            return(riceList);
        }
示例#2
0
        public List <InventoryUtility.Rice> UpdateToInventory(List <InventoryUtility.Rice> rice)
        {
            InventoryUtility.Rice utility = new InventoryUtility.Rice();
            Console.WriteLine("enter Name of rice to be updated:");
            string Name = Console.ReadLine();

            rice.Remove(rice.Find(ut => ut.Name.Equals(Name)));

            Console.WriteLine("enter price of rice :");
            utility.Name = Console.ReadLine();
            Console.WriteLine("enter price of rice:");
            utility.Price = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("enter weight in kg of rice:");
            utility.Kg = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("enter type of rice:");
            utility.Type = Console.ReadLine();
            rice.Add(utility);
            return(rice);
        }