public JsonResult Search(string term) { var list = new List <SearchResponseElement>(); try { var lots = _lotService.GetActiveLots().Where(t => t.LotName.ToUpper().Contains(term.ToUpper())); foreach (var lot in lots) { list.Add(new SearchResponseElement() { Type = "Lot", Title = lot.LotName, Link = Url.Action("LotDetails", "Lot", new { id = lot.Id }) }); } return(Json(list, JsonRequestBehavior.AllowGet)); } catch (Exception exception) { Log.LogError(exception); return (Json(new List <SearchResponseElement>() { new SearchResponseElement() { Type = "Error", Link = Url.Action("Index", "Lot"), Title = "Search error" } })); } }
public ActionResult AllLots() { ViewBag.Sections = _sectionService.GetAllSectionEntities() .Select(s => s.ToSectionDetailsModel()).Where(s => s.Categories.Count != 0); var lots = _lotService.GetActiveLots() //GetAllLotEntities().Where(l => l.IsConfirm && !l.IsBlocked) .Select(l => l.ToLotRowViewModel()).OrderByDescending(lot => lot.StartDate); return(View(lots)); }
public IHttpActionResult GetActive() { return(Ok(Mapper.Map <IEnumerable <LotDTO>, List <LotModel> >(lotService.GetActiveLots()))); }