Example #1
0
 public DataTable ListBySellingProductType(SellingProductType type, int count)
 {
     try
     {
         var param = new SqlParameter[2];
         param[0] = new SqlParameter("@SellingProductType", (byte)type);
         param[1] = new SqlParameter("@count", count);
         return(SQLHelper.GetDataTable(CommandType.StoredProcedure, "app.spGetsProductBySellingProductType", param));
     }
     catch (Exception e) { throw; }
 }
Example #2
0
        public Result <List <ShowProductOnHomePageListVM> > ListBySellingProductType(SellingProductType type, int?count)
        {
            count = count ?? 4;
            var table = ConvertDataTableToList.BindList <ShowProductOnHomePageListVM>(_dataSource.ListBySellingProductType(type, count.Value));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <ShowProductOnHomePageListVM> > .Successful(data : table));
            }
            return(Result <List <ShowProductOnHomePageListVM> > .Failure());
        }
        public ActionResult Buy(SellingProductType Type, int?page)
        {
            int pageSize   = 4;
            int pageNumber = (page ?? 1);

            var productResult = _service.ListBySellingProductType(Type, Helper.CountShowProduct);

            if (!productResult.Success)
            {
                return(View("Error", new Error {
                    ClassCss = "alert alert-danger", ErorrDescription = "آگهی مورد نظر یافت نشد"
                }));
            }
            var product = productResult.Data;

            return(View(product.ToPagedList(pageNumber, pageSize)));
        }