async Task UpdateCastAsync() { 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(); int res = await castService.UpdateCastAsync(c); if (res > 0) { Console.WriteLine("Cast Updated successfully"); } else { Console.WriteLine("Some error has occurred"); } }
async Task UpdateCastAsync() { 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 = await castService.UpdateCastAsync(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"); } }