Esempio n. 1
0
        async Task DeleteCastAsync()
        {
            try
            {
                Console.Write("Enter Id => ");
                int id  = Convert.ToInt32(Console.ReadLine());
                int res = await castService.DeleteCastAsync(id);

                if (res > 0)
                {
                    Console.WriteLine("Cast delete 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");
            }
        }
Esempio n. 2
0
        async Task DeleteCastAsync()
        {
            Console.Write("Enter Cast Id = ");
            int  id = Convert.ToInt32(Console.ReadLine());
            Cast c  = await castService.GetByIdAsync(id);

            if (await castService.DeleteCastAsync(id) > 0)
            {
                Console.WriteLine($"Cast Id: {id} Name: {c.Name} deleted");
            }
            else
            {
                Console.WriteLine("Some error occurred");
            }
        }
Esempio n. 3
0
        async Task DeleteCastAsync()
        {
            Console.Write("Enter Id = ");
            int  id = Convert.ToInt32(Console.ReadLine());
            Cast c  = castService.GetById(id);

            int res = await castService.DeleteCastAsync(c.Id);

            if (res > 0)
            {
                Console.WriteLine($"Genre {c.Name} deleted successfully");
            }
            else
            {
                Console.WriteLine("Some error has occurred");
            }
        }