Exemplo n.º 1
0
 public static void GetAll(ORM ado)
 {
     Console.WriteLine();
     foreach (var s in ado.GetAllStatus())
     {
         Console.WriteLine("{0}\t{1}", s.Id, s.Status);
     }
 }
Exemplo n.º 2
0
        public static void Update(ORM orm)
        {
            bool checkUpdate = true;

            while (checkUpdate == true)
            {
                Console.Write("\nEnter the id you want to update: ");
                int id = Convert.ToInt32(Console.ReadLine());
                if (id == 0)
                {
                    checkUpdate = false;
                }
                var st = orm.GetAllStatus().Where(x => x.Id == id).FirstOrDefault();

                Console.WriteLine("\nChoose the column you want to change:\n" + "1.Status\n" + "<-Back\n");
                Console.Write(">>");
                string choiceUpdate = Console.ReadLine();
                try
                {
                    switch (choiceUpdate)
                    {
                    case "Status":
                        Console.Write("\nUpdate Status: ");
                        string status = Console.ReadLine();

                        orm.Update(new DeliveryStatus
                        {
                            Id     = st.Id,
                            Status = status
                        });
                        break;

                    case "Back":
                        checkUpdate = false;
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }