public Model.Transaction Create(Model.Transaction transaction, int?targetGoalId) { //Set the parameters and string sql = LoadSqlResources().First().Value; Dictionary <string, object> parameters = ConvertToParameters(transaction); parameters.Add("TargetGoalId", targetGoalId); return(typedDataAccess.ExecuteQuery <Model.Transaction>(sql, parameters).First()); }
public Model.Goal CreateGoalForUser(int userID, Model.Goal goal) { string sql = base.LoadSqlResources().Values.First(); Dictionary <string, object> parameters = ConvertToParameters ( new { UserId = userID, goal.Name, goal.Description, goal.Target, StatusId = GoalStatus.Open, goal.IsDefault } ); //Execute and return the goal Model.Goal savedGoal = typedDataAccess.ExecuteQuery <Model.Goal>(sql, parameters).First(); return(savedGoal); }
public IEnumerable <Model.Milestone> GetAll() { string sql = LoadSqlResources().Values.First(); return(typedDataAccess.ExecuteQuery <Model.Milestone>(sql)); }