//Method to insert new user public string InsertNewUserDA(TodoListBusinessObject todoListBO) { using (var context = new TodolistDataContext(connectionString)) { try { if (context.Connection.State == System.Data.ConnectionState.Closed) { context.Connection.Open(); } //context.InsertOnSubmit(todoListBO); context.InsertNewUser(todoListBO.name, todoListBO.EmailID, todoListBO.Pwd, todoListBO.SecurityQuestion, todoListBO.SecurityAnswer, todoListBO.Phone, todoListBO.ZipCode, todoListBO.Country, todoListBO.DateOfBirth, todoListBO.IsActive); context.SubmitChanges(); return("The User Registered Successfully"); } catch { return("The User Did Not Register"); } finally { context.Connection.Close(); } } }
//Method to Update User Details public void UpdateUserDetailsDA(TodoListBusinessObject todoListBO) { using (var context = new TodolistDataContext(connectionString)) { if (context.Connection.State == System.Data.ConnectionState.Closed) { context.Connection.Open(); } context.InsertNewUser(todoListBO.name, todoListBO.EmailID, todoListBO.Pwd, todoListBO.SecurityQuestion, todoListBO.SecurityAnswer, todoListBO.Phone, todoListBO.ZipCode, todoListBO.Country, todoListBO.DateOfBirth, todoListBO.IsActive); context.SubmitChanges(); } }