public List <SubcategoryListModel> admin_subcategoryList(SubcategoryListModel model, out int RowCount)
 {
     using (categoryRepository = new Category_SubcategoryRepository())
     {
         return(categoryRepository.admin_subcategoryList(model, out RowCount));
     }
 }
 //Update Subcategory
 public async Task <TranStatus> updateSubcategory(int Sid, SubcategoryListModel model)
 {
     using (categoryRepository = new Category_SubcategoryRepository())
     {
         return(await categoryRepository.updateSubcategory(Sid, model));
     }
 }
예제 #3
0
        public static SubcategoryListModel DataReader_to_SubcategoryModel_List(SqlDataReader reader, string categoryNameKey)
        {
            SubcategoryListModel subcategory = new SubcategoryListModel();

            subcategory.SubcategoryID      = (Guid)reader["SubcategoryID"];
            subcategory.SubcategoryName    = (String)reader["SubcategoryName"];
            subcategory.SubcategoryNameKey = (String)reader["SubcategoryNameKey"];
            subcategory.OrderID            = (int)reader["OrderID"];
            subcategory.Visible            = (bool)reader["Visible"];

            subcategory.LocationPath       = categoryNameKey;
            subcategory.FullyQualifiedName = categoryNameKey + "/" + subcategory.SubcategoryNameKey;

            return(subcategory);
        }
        public List <SubcategoryListModel> admin_subcategoryList(SubcategoryListModel model, out int RowCount)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                TranStatus        transaction = new TranStatus();
                DynamicParameters parameter   = new DynamicParameters();
                parameter.Add("@AdminID", model.userId);
                parameter.Add("@pageIndex", model.pageIndex);
                parameter.Add("@pageSize", model.pageSize);
                parameter.Add("@Search", model.Search);

                parameter.Add("@RowCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
                var result = connection.Query <SubcategoryListModel>("admin_subcategoryList", parameter, commandType: CommandType.StoredProcedure);
                RowCount = parameter.Get <int>("@RowCount");
                return(result.ToList());
            }
        }
        public async Task <IActionResult> updateSubcategory(int Sid, [FromBody] SubcategoryListModel model)
        {
            Dictionary <String, Object> dctData = new Dictionary <string, object>();
            HttpStatusCode statusCode           = HttpStatusCode.OK;
            TranStatus     transaction          = new TranStatus();

            try
            {
                transaction = await icategory.updateSubcategory(Sid, model);
            }
            catch (Exception ex)
            {
                transaction = CommonHelper.TransactionErrorHandler(ex);
                statusCode  = HttpStatusCode.BadRequest;
            }
            dctData.Add("Status", transaction);
            return(this.StatusCode(Convert.ToInt32(statusCode), dctData));
        }
        //Update Subcategory
        public async Task <TranStatus> updateSubcategory(int Sid, SubcategoryListModel model)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                await connection.OpenAsync();

                TranStatus        transaction = new TranStatus();
                DynamicParameters parameter   = new DynamicParameters();
                parameter.Add("@Sid", Sid);
                parameter.Add("@Sname", model.Sname);
                parameter.Add("@Cid", model.Cid);
                parameter.Add("@Modifiedby", model.Modifiedby);

                parameter.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 500);
                parameter.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output);
                await connection.QueryAsync("updateSubcategory", parameter, commandType : CommandType.StoredProcedure);

                transaction.returnMessage = parameter.Get <string>("@Message");
                transaction.code          = parameter.Get <int>("@Code");
                return(transaction);
            }
        }
        public IActionResult admin_subcategoryList([FromBody] SubcategoryListModel model)
        {
            TranStatus transaction = new TranStatus();
            Dictionary <String, Object> dctData = new Dictionary <string, object>();
            HttpStatusCode statusCode           = HttpStatusCode.OK;

            try
            {
                List <SubcategoryListModel> subcategoryList = new List <SubcategoryListModel>();
                int rowcount = 0;
                subcategoryList = icategory.admin_subcategoryList(model, out rowcount);

                dctData.Add("admin_subcategoryList", subcategoryList);
                dctData.Add("RowCount", rowcount);
            }
            catch (Exception ex)
            {
                transaction = CommonHelper.TransactionErrorHandler(ex);
                statusCode  = HttpStatusCode.BadRequest;
            }
            dctData.Add("Status", transaction);
            return(this.StatusCode(Convert.ToInt32(statusCode), dctData));
        }