public ActionResult Index(string _searchKey, DateTime?_formDate, DateTime?_toDate, int?_pageIndex) { ContactView result; result = _services.GetAll(_searchKey, _formDate, _toDate, false, _pageIndex, 20); int totalPage = result?.Total ?? 0; ViewBag.TotalPage = totalPage; ViewBag.PageIndex = _pageIndex ?? 1; ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey; return(View(result.Contacts)); }
// GET: api/Contact public HttpResponseMessage Get() { HttpRequestHeaders headers = Request.Headers; bool includeArchived = false; if (headers.Contains("includeArchived")) { includeArchived = bool.Parse(headers.GetValues("includeArchived").First()); } var contact = _contactServices.GetAll(includeArchived); var contactEntities = contact?.ToList(); return(contactEntities != null && contactEntities.Any() ? Request.CreateResponse(HttpStatusCode.OK, contactEntities) : Request.CreateErrorResponse(HttpStatusCode.NotFound, "Contacts not found")); }
public async Task <IEnumerable <Contact> > GetAllContacts() { return(await _contactService.GetAll()); }