예제 #1
0
 public IEnumerable <ImageModel> Get(CurrentUserModel currentUser)
 {
     try
     {
         CustomDynamicParameters  parameters = new CustomDynamicParameters(currentUser);
         IEnumerable <ImageModel> result     = ExecuteQuery <ImageModel>("Get_Image", parameters);
         return(result);
     }
     catch (Exception ex)
     {
         LogManager.LogError("Image get all", ex);
         throw;
     }
 }
예제 #2
0
 public IEnumerable <ImageModel> GetByCategory(string type, CurrentUserModel currentUser)
 {
     try
     {
         CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser);
         parameters.Add("@i_Category", type);
         IEnumerable <ImageModel> result = ExecuteQuery <ImageModel>("Get_ImageByCategory", parameters);
         return(result);
     }
     catch (Exception ex)
     {
         LogManager.LogError("Get all images by category", ex);
         throw;
     }
 }
예제 #3
0
 public ImageModel Get(int id, CurrentUserModel currentUser)
 {
     try
     {
         CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser);
         parameters.Add("@i_Id", id);
         ImageModel result = ExecuteQuery <ImageModel>("Get_ImageById", parameters).FirstOrDefault();
         return(result);
     }
     catch (Exception ex)
     {
         LogManager.LogError("Image get by id", ex);
         throw;
     }
 }
예제 #4
0
        public bool Add(ImageModel entity, CurrentUserModel currentUser)
        {
            try
            {
                CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser);

                ExecuteNoneQuery("Add_Image", parameters);
                return(true);
            }
            catch (Exception ex)
            {
                LogManager.LogError("Add Image: ", ex);
                throw ex;
            }
        }
예제 #5
0
        public bool Update(int id, ImageModel entity, CurrentUserModel currentUser)
        {
            try
            {
                CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser);
                parameters.Add("@i_Id", id);

                ExecuteNoneQuery("Update_Image", parameters);
                return(true);
            }
            catch (Exception ex)
            {
                LogManager.LogError("Update Image: ", ex);
                throw ex;
            }
        }
예제 #6
0
        public bool Delete(int id, CurrentUserModel currentUser)
        {
            try
            {
                CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser);
                parameters.Add("@i_Id", id);
                ExecuteNoneQuery("Delete_Image", parameters);
                return(true);
            }
            catch (Exception ex)
            {
                LogManager.LogError("Image delete by id", ex);
                return(false);

                throw;
            }
        }