public IEnumerable <Todo> GetTodos() { using (var cmd = _databaseFactory.CreateCommand()) { //SearchBorrowing searchBorrowing = new SearchBorrowing(); SqlParameter[] parameters = new SqlParameter[0]; using (var reader = SqlHelper.GetDataReader((SqlConnection)cmd.Connection, "USP_GetAllTask", (SqlCommand)cmd, CommandType.StoredProcedure, parameters.Cast <SqlParameter>().ToList())) { return(MappingTodoList(reader).ToList()); } } //var test = from abc in db.Tbl_User // select new Todo // { // Id = abc.Id, // TaskName = abc.UserName // }; //return test.ToList(); }
public IEnumerable <ListData> listDatas() { using (var cmd = _databaseFactory.CreateCommand()) { //SearchBorrowing searchBorrowing = new SearchBorrowing(); SqlParameter[] parameters = new SqlParameter[0]; using (var reader = SqlHelper.GetDataReader((SqlConnection)cmd.Connection, "USP_GetAllStatus", (SqlCommand)cmd, CommandType.StoredProcedure, parameters.Cast <SqlParameter>().ToList())) { return(MappingTodoList(reader).ToList()); } } }
public string Register(User user) { string result = ""; using (var cmd = _databaseFactory.CreateCommand()) { SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter() { Value = user.Username, ParameterName = "@UserName" }; parameters[1] = new SqlParameter() { Value = user.Password, ParameterName = "@Password" }; var db = SqlHelper.DoSqlAggregateQuery((SqlConnection)cmd.Connection, CommandType.StoredProcedure, (SqlCommand)cmd, "USP_RegisterUser", parameters.Cast <SqlParameter>().ToList(), (SqlTransaction)cmd.Transaction); result = db.ToString(); } return(result); }