Пример #1
0
        /// <summary>
        /// Create the given user on Registry
        /// </summary>
        /// <param name="newResource">New Resource to create</param>
        public void AddNewResource(Resource newResource)
        {
            DAL.ResourceRepo repo = null;

            try
            {
                repo = new DAL.ResourceRepo();
                repo.Add(newResource);
            }
            catch (Exception ex)
            {
                LogManager.Error(ex.Message);
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// Return a Resource with a specific identifier
        /// </summary>
        /// <param name="id">the Resource identifier</param>
        /// <returns>The resource identified</returns>
        public Resource GetResourceById(int id)
        {
            DAL.ResourceRepo repo = null;
            Resource         res  = null;

            try
            {
                repo = new DAL.ResourceRepo();
                res  = repo.GetById(id);
                return(res);
            }
            catch (Exception ex)
            {
                LogManager.Error(ex.Message);
                throw ex;
            }
        }
Пример #3
0
        /// <summary>
        /// Return a Resource with a specific username
        /// </summary>
        /// <param name="username">The resource username</param>
        /// <returns>The resource identified</returns>
        public Resource GetResourceByUser(string username)
        {
            DAL.ResourceRepo repo = null;
            Resource         res  = null;

            try
            {
                repo = new DAL.ResourceRepo();
                res  = repo.GetByUser(username);
                return(res);
            }
            catch (Exception ex)
            {
                LogManager.Error(ex.Message);
                throw ex;
            }
        }
Пример #4
0
        /// <summary>
        /// Returns a list of all Resources
        /// </summary>
        /// <returns>A list of all Resources(Entities)</returns>
        public IEnumerable <Resource> GetAllResources()
        {
            DAL.ResourceRepo       repo = null;
            IEnumerable <Resource> res  = null;

            try
            {
                repo = new DAL.ResourceRepo();
                res  = repo.GetAll();
                return(res);
            }
            catch (Exception ex)
            {
                LogManager.Error(ex.Message);
                throw ex;
            }
        }