Beispiel #1
0
        public ActionResult Index(PredictionViewModel model)
        {
            try
            {
                ViewBag.Statistics  = _mapper.Map <PredictionStatisticsViewModel>(_predictionStatisticsService.GetStatistics(_mapper.Map <Prediction>(model)));
                ViewBag.SearchModel = model;
                var request = new FilteredModel <Prediction>();
                var offset  = (model.ThisPageIndex - 1) * model.ThisPageSize;

                var result = _mapper.Map <IList <PredictionViewModel> >(_predictionService.GetPaging(_mapper.Map <Prediction>(model), out long totalCount, model.PageOrderBy, model.PageOrder, offset, model.ThisPageSize));
                ViewBag.OnePageOfEntries = new StaticPagedList <PredictionViewModel>(result, model.ThisPageIndex, model.ThisPageSize, (int)totalCount);
                ViewBag.EventsList       = new SelectList(_dropDownService.GetEvents(), "id", "name", null);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                if (ex.InnerException != null && ex.InnerException.Source.Equals(GeneralMessages.ExceptionSource))
                {
                    ModelState.AddModelError(string.Empty, ex.Message);
                }
                else
                {
                    ModelState.AddModelError(string.Empty, GeneralMessages.UnexpectedError);
                }
            }
            return(View());
        }
        // GET: Club/Create
        public ActionResult Create()
        {
            var model = new ClubViewModel();

            ViewBag.EventsList = new SelectList(_dropDownService.GetEvents(), "id", "name", null);
            return(View(model));
        }
        public JsonResult DropDown(string key, int?p)
        {
            if (string.IsNullOrWhiteSpace(key) || key.Length < 3)
            {
                return(null);
            }
            var result = _mapper.Map <List <DropDownViewModel> >(_dropDownService.GetEvents(key, (p.GetValueOrDefault(1) - 1) * 30, 30, out long totalCount));

            return(Json(new DropDownModel {
                TotalCount = totalCount, Items = result
            }, JsonRequestBehavior.AllowGet));
        }
 // GET: MatchGroup/Create
 public ActionResult Create()
 {
     ViewBag.EventsList = new SelectList(_dropDownService.GetEvents(), "id", "name", null);
     return(View(new MatchGroupViewModel()));
 }