Ejemplo n.º 1
0
        public List <Award> GetAllAwardsOfUser(User user)
        {
            try
            {
                List <Award> awardsList = new List <Award>();

                using (SqlConnection connection = new SqlConnection(_connectionString))
                {
                    var stProc = "GetAllAwardsOfUser";

                    var command = new SqlCommand(stProc, connection)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    SqlParameter idParam = new SqlParameter("@id", user.id);
                    command.Parameters.Add(idParam);

                    connection.Open();

                    var reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        awardsList.Add(awardsDao.GetAwardByID(Guid.Parse(reader["awardid"] as string)));
                    }
                }

                return(awardsList);
            }
            catch (SqlException)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
 public Award GetAwardByID(int ID)
 {
     return(_awardsDAO.GetAwardByID(ID));
 }
Ejemplo n.º 3
0
 public Award GetAwardByID(Guid id) => daoAwards.GetAwardByID(id);