Beispiel #1
0
        void UpdateCast()
        {
            Cast c = new Cast();

            Console.Write("Enter Id = ");
            c.Id = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter Cast Name = ");
            c.Name = Console.ReadLine();

            Console.Write("Enter Gender = ");
            c.Gender = Console.ReadLine();

            Console.Write("Enter TmbdUrl = ");
            c.TmdbUrl = Console.ReadLine();

            Console.Write("Enter ProfilePath = ");
            c.ProfilePath = Console.ReadLine();

            if (castService.UpdateCast(c) > 0)
            {
                Console.WriteLine("Cast Updated successfully");
            }
            else
            {
                Console.WriteLine("Some error has occurred");
            }
        }
Beispiel #2
0
        void UpdateCast()
        {
            try
            {
                Cast c = new Cast();

                Console.Write("Enter Id => ");
                c.Id = Convert.ToInt32(Console.ReadLine());

                Console.Write("Enter Name => ");
                c.Name = Console.ReadLine();

                Console.Write("Enter Gender => ");
                c.Gender = Console.ReadLine();

                Console.Write("Enter TmdbUrl => ");
                c.TmdbUrl = Console.ReadLine();

                Console.Write("Enter ProfilePath => ");
                c.ProfilePath = Console.ReadLine();

                int res = castService.UpdateCast(c);

                if (res > 0)
                {
                    Console.WriteLine("Cast update successfully");
                }
                else
                {
                    Console.WriteLine("Some error occurs. Data not found.");
                }
            }
            catch (FormatException fe)
            {
                Console.WriteLine("Only numbers are allowed");
            }
            catch (OverflowException oe)
            {
                Console.WriteLine("value must be in between 1 to " + int.MaxValue);
            }
            catch (Exception ex)
            {
                Console.WriteLine("some error has been occured. Contact the admin department");
            }
        }