// GET: Quote public ActionResult Index(int?page) { var quotes = _quoteRepository.GetAll(); int pageSize = 5; int pageNumber = (page ?? 1); return(View(quotes.ToPagedList(pageNumber, pageSize))); }
// GET: Quote public ActionResult Index(int?page) { var quotes = _quoteRepository.GetAll(); int pageSize = 5; int pageNumber = (page ?? 1); ViewBag.AuthorsHome = _authorRepository.GetAll().OrderByDescending(a => a.AuthorID).Take(8); return(View(quotes.ToPagedList(pageNumber, pageSize))); }
public async Task <IActionResult> Get() { var allQuotes = new List <Quote.DataAccess.Models.Quote>(); try { allQuotes = await quoteRepository.GetAll(); } catch (Exception ex) { throw ex; } return(this.Ok(allQuotes)); }
public QuoteResponse GetQuoteResponse(int?id) { QuoteResponse response = new QuoteResponse(); if (id != null) { response.Quote = quoteRepository.GetQuoteAndQuoteDetail((int)id); } else { response.QuoteCount = quoteRepository.GetAll().Count() + 1; } //BaseData response.Contacts = contactRepository.GetAll().ToList(); response.Products = productRepository.GetAll().ToList(); response.ProductModels = productModelRepository.GetAll().ToList(); response.Exclusions = exclusionRepository.GetAll().ToList(); return(response); }
public ActionResult <List <Quote> > GetAll() { return(quoteRepository.GetAll()); }
public Task <List <Quote> > GetAll() { return(_quoteRepository.GetAll()); }
public ActionResult Index(string channelName) { var quotes = db.GetAll(channelName); return(View(quotes)); }
public QuoteModule(IQuoteRepository repo) { _repo = repo; #region Before Request Hook Before += ctx => { Console.WriteLine("I'm about to execute {0}", ctx.Request.Url.ToString()); return(null); }; #endregion Get["/quote"] = _ => { var quotes = _repo.GetAll(); SetUserName(quotes); return(View["Index.cshtml", quotes]); }; Get["/api/quote"] = _ => { //need to materialize the list... // content negotiation won't render to XML // but JSON works fine if just an IEnumerable<> return(_repo.GetAll().Quotes.ToList()); }; Get["/quote/{id}"] = args => { var quote = _repo.GetWithDetail(args.id); SetUserName(quote); return(View["details.cshtml", quote]); }; Get["/quote/create"] = _ => { this.RequiresAuthentication(); var model = new Quote(); SetUserName(model); return(View["create.cshtml", model]); }; Post["/quote/create"] = args => { this.RequiresAuthentication(); var newQuote = this.Bind <Quote>(); if (_repo.Insert(newQuote)) { return(this.Response.AsRedirect("/quote")); } else { return(View["index.cshtml"]); } }; Get["/quote/delete/{id}"] = args => { this.RequiresAuthentication(); _repo.DeleteById(args.id); return(this.Response.AsRedirect("/quote")); }; Get["/quote/edit/{id}"] = args => { this.RequiresAuthentication(); var quote = _repo.GetById(args.id); SetUserName(quote); return(View["edit.cshtml", quote]); }; Post["/quote/edit/{id}"] = model => { this.RequiresAuthentication(); var theQuote = this.Bind <Quote>(); if (_repo.Update(theQuote)) { return(this.Response.AsRedirect("/quote")); } else { return("ooops!"); } }; Get["/quote/search"] = args => { var model = new QuoteHighlights(); SetUserName(model); Int32 numFound; var searchResults = _repo.Search((String)this.Request.Query.id, out numFound); ViewBag.TotalResults = numFound; ViewBag.NumberShown = searchResults.Count(); ViewBag.Term = (String)this.Request.Query.id; model.Quotes = searchResults.ToList(); return(View["search.cshtml", model]); }; }
public ActionResult Create() { ViewBag.Quotes = _quoteRepository.GetAll(); ViewBag.Users = _userRepository.GetAll(); return(View()); }
public IActionResult Get() { return(Ok(_quoteRepository.GetAll())); }