Esempio n. 1
0
        // GET: Bidding
        public ActionResult CurrentPost()
        {
            BiddingRepository postingRepository = new BiddingRepository(this.UserId);
            var post = postingRepository.GetPostingList(this.UserId, false);

            return(View(post.Response));
        }
Esempio n. 2
0
        // GET: Bidding
        public ActionResult ClosePost()
        {
            var message = string.Empty;
            BiddingRepository postingRepository = new BiddingRepository(this.UserId);
            var post = postingRepository.GetPostingList(this.UserId, true);

            return(View(post.Response));
        }
Esempio n. 3
0
        public IHttpActionResult GetPostingListByUserId([FromUri] BiddingUserParam param)
        {
            using (var repository = new BiddingRepository(param.UserId))
            {
                var result = repository.GetPostingList(param.UserId, param.IsPast);

                return(Ok(new { result.Status, data = result }));
            }
        }
Esempio n. 4
0
        public ActionResult GetActivePost([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            var message = string.Empty;
            BiddingRepository postingRepository = new BiddingRepository(this.UserId);
            var post = postingRepository.GetPostingList(this.UserId, false);
            IQueryable <PostingListBid> query = post.Response.AsQueryable();
            var totalCount = query.Count();

            #region Filtering
            // Apply filters for searching
            if (requestModel.Search.Value != string.Empty)
            {
                var value = requestModel.Search.Value.Trim();
                query = query.Where(p => p.From.Contains(value) ||
                                    p.To.Contains(value) ||
                                    p.materialtype.Contains(value) ||
                                    p.packagetype.Contains(value)
                                    );
            }

            var filteredCount = query.Count();

            #endregion Filtering

            #region Sorting
            // Sorting
            var sortedColumns = requestModel.Columns.GetSortedColumns();
            var orderByString = String.Empty;

            foreach (var column in sortedColumns)
            {
                orderByString += orderByString != String.Empty ? "," : "";
                orderByString += (column.Data) + (column.SortDirection == Column.OrderDirection.Ascendant ? " asc" : " desc");
            }

            query = query.OrderBy(orderByString == string.Empty ? "biddingclosedatetime asc" : orderByString);

            #endregion Sorting

            // Paging
            query = query.Skip(requestModel.Start).Take(requestModel.Length);


            var data = query.ToList();

            return(Json(new DataTablesResponse(requestModel.Draw, data, filteredCount, totalCount), JsonRequestBehavior.AllowGet));
        }