Ejemplo n.º 1
0
        public virtual IActionResult Search(
            int draw, int?start = null, int?length = null,
            int?statusID        = null)
        {
            int    recordsTotal    = 0;
            int    recordsFiltered = 0;
            string error           = "";

            //var curUser = accountUtil.GetCurrentUser(User);

            IQueryable <WithdrawRequest> dataIQueryable = WithdrawRequestService.Search(
                start,
                length,

                out recordsTotal,
                out recordsFiltered,
                out error,

                statusID,
                null
                );

            dynamic data = dataIQueryable
                           .Select(m => new WithdrawRequestListItemForAdminVM(m))
                           .ToList();

            return(Json(new
            {
                draw = draw,
                recordsTotal = recordsTotal,
                recordsFiltered = recordsFiltered,
                data = data,
                error = error
            }));
        }
Ejemplo n.º 2
0
        public ActionResult <object> Index(int draw, int?start = null, int?length = null,
                                           int?statusID        = null)
        {
            try
            {
                int    recordsTotal    = 0;
                int    recordsFiltered = 0;
                string error           = "";

                var curUser = accountUtil.GetCurrentUser(User);
                var talent  = TalentService.GetByUserID(curUser.ID);
                if (talent == null)
                {
                    throw new Exception("Талант не найден");
                }

                IQueryable <WithdrawRequest> dataIQueryable = WithdrawRequestService.Search(
                    start,
                    length,

                    out recordsTotal,
                    out recordsFiltered,
                    out error,

                    statusID,
                    talent.ID
                    );

                if (!string.IsNullOrWhiteSpace(error))
                {
                    throw new Exception("Ошибка при получении списка");
                }

                dynamic data = dataIQueryable
                               .Select(m => new WithdrawRequestListItemForExpertAndUserVM(m))
                               .ToList();

                return(new
                {
                    //draw = draw,
                    records_total = recordsTotal,
                    //recordsFiltered = recordsFiltered,
                    data = data,
                    //error = error
                });
            }
            catch (Exception ex)
            {
                return(CustomBadRequest(ex));
            }
        }