@@ -32,7 +32,7 @@ static void Main(string[] args)
3232 Console . WriteLine ( "\n Created User: " + newUser . ToString ( ) ) ;
3333
3434 // Create demo: Create a Task instance and save it to the database
35- Task newTask = new Task ( ) { Title = "Ship Helsinki" , IsComplete = false , DueDate = DateTime . Parse ( "04-01-2017" ) } ;
35+ Task newTask = new Task ( ) { Title = "Ship Helsinki" , IsComplete = false , DueDate = DateTime . ParseExact ( "04-01-2017" , "MM-dd-yyyy" , CultureInfo . InvariantCulture ) } ;
3636 context . Tasks . Add ( newTask ) ;
3737 context . SaveChanges ( ) ;
3838 Console . WriteLine ( "\n Created Task: " + newTask . ToString ( ) ) ;
@@ -56,13 +56,13 @@ static void Main(string[] args)
5656 // Update demo: change the 'dueDate' of a task
5757 Task taskToUpdate = context . Tasks . First ( ) ; // get the first task
5858 Console . WriteLine ( "\n Updating task: " + taskToUpdate . ToString ( ) ) ;
59- taskToUpdate . DueDate = DateTime . Parse ( "06-30-2016" ) ;
59+ taskToUpdate . DueDate = DateTime . ParseExact ( "06-30-2016" , "MM-dd-yyyy" , CultureInfo . InvariantCulture ) ;
6060 context . SaveChanges ( ) ;
6161 Console . WriteLine ( "dueDate changed: " + taskToUpdate . ToString ( ) ) ;
6262
6363 // Delete demo: delete all tasks with a dueDate in 2016
6464 Console . WriteLine ( "\n Deleting all tasks with a dueDate in 2016" ) ;
65- DateTime dueDate2016 = DateTime . Parse ( "12-31-2016" ) ;
65+ DateTime dueDate2016 = DateTime . ParseExact ( "12-31-2016" , "MM-dd-yyyy" , CultureInfo . InvariantCulture ) ;
6666 query = from t in context . Tasks
6767 where t . DueDate < dueDate2016
6868 select t ;
0 commit comments