public async Task <IActionResult> GetAll() { var Result = new Res(); try { BackgroundJob.Enqueue(() => _customerServices.GetAll()); var data = await Task.Run(() => _customerServices.GetAll()); if (data != null) { Result.Data = data; Result.Status = true; Result.Message = MessageResponse.CALL_API_SUCCESS; Result.StatusCode = HttpStatusCode.OK; } else { Result.Data = null; Result.Status = false; Result.Message = MessageResponse.DATA_NOT_FOUND; Result.StatusCode = HttpStatusCode.NotFound; } return(Ok(Result)); } catch (Exception ex) { return(NotFound(ex.Message)); } }
public JsonResult CustomerList() { List <CustomerDetail> customerDetailResult = new List <CustomerDetail>(); #region Authorize var authorizeMenuAccessResult = AuthorizeMenuAccess(LookupKey.Menu.CustomerMenuId); if (!authorizeMenuAccessResult.IsSuccess) { return(Json(new { isSuccess = true, messageAlert = authorizeMenuAccessResult.MessageAlert, CustomerDetailsResult = customerDetailResult }, JsonRequestBehavior.AllowGet)); } #endregion var currentUserId = Session[LookupKey.SessionVariables.UserId].IsNull() ? 0 : Convert.ToInt64(Session[LookupKey.SessionVariables.UserId]); customerDetailResult = _customerServices.GetAll().ToList(); var response = new { CustomerDetailsResult = customerDetailResult, isSuccess = true, messageAlert = "" }; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(string sortOrder, string searchString, string currentFilter, bool showRentalHistory = false, int pageNumber = 1, int pageSize = 10, int id = 0) { if (searchString == null) { searchString = currentFilter; } var model = DependencyResolver.Current.GetService <CustomerIndexViewModel>(); //IEnumerable<IRental> rentals; _parameterBuilder.Build(model, searchString: searchString, sortingParam: sortOrder, pageSize: pageSize, pageNumber: pageNumber, id: id, IncludeRentalHistory: showRentalHistory); IEnumerable <IRental> rentals; model.Customers = _customerServices.GetAll(out rentals, model.Sorting, model.Filtering, model.Paging, model.Options); model.Rentals = rentals; ViewBag.LastNameSort = String.IsNullOrEmpty(sortOrder) ? "lName_desc" : ""; ViewBag.FirstNameSort = sortOrder == "fName" ? "fName_desc" : "fName"; ViewBag.AccountNumberSort = sortOrder == "accountNo" ? "accountNo_desc" : "accountNo"; ViewBag.PageSelectList = new SelectList(new List <int> { 5, 10, 20, 40 }, model.Customers.PageSize); return(View(model)); }
public IActionResult GetAll() { var result = _customerServices.GetAll(); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetAll() { var Result = _customerServices.GetAll(); if (Result.Result.Data != null) { return(Ok(Result.Result.Data)); } return(BadRequest(Result)); }
public IActionResult Get() { try { return(new ObjectResult(_customerServices.GetAll())); } catch (Exception ex) { return(BadRequest(ex)); } }
public JsonResult CustomerList() { var result = _customerServices.GetAll().Where(c => c.CustomerStatusId == LookupKey.CustomerStatus.ActiveId).ToList(); var response = new { result = result, isSuccess = true }; return(Json(response, JsonRequestBehavior.AllowGet)); }
public IActionResult GetAll() { try { var model = _customerServices.GetAll(); return(Ok(model)); } catch (Exception ex) { return(NotFound(ex.Message)); } }
public IActionResult GetAll() { var customers = _customerServices.GetAll(); if (customers.Count() > 0) { return(Ok(customers)); } else { return(NoContent()); } }
public ActionResult <List <CustomerViewModel> > GetAll() { try { _logger.LogInformation("Received GetAll request"); var clients = _customerServices.GetAll(); return(Ok(_mapper.Map <List <CustomerViewModel> >(clients))); } catch (Exception exception) { _logger.LogError(exception, exception.Message); return(new StatusCodeResult(500)); } }
// GET: api/Customer public HttpResponseMessage Get() { HttpRequestHeaders headers = Request.Headers; bool includeArchived = false; if (headers.Contains("includeArchived")) { includeArchived = bool.Parse(headers.GetValues("includeArchived").First()); } var customer = _customerServices.GetAll(includeArchived); var customerEntities = customer?.ToList(); return(customerEntities != null && customerEntities.Any() ? Request.CreateResponse(HttpStatusCode.OK, customerEntities) : Request.CreateErrorResponse(HttpStatusCode.NotFound, "Customers not found")); }
private void UpdateGridCustomerData(bool isNotShipment = false) { ViewData["CustomerTypes"] = CustomerTypes; var totalRow = 0; var page = _customerGrid.Pager; var sort = new SSM.Services.SortField(string.IsNullOrEmpty(page.Sidx) ? "FullName" : page.Sidx, page.Sord == "asc"); IEnumerable <Customer> customers = customerServices.GetAll(_customerGrid.SearchCriteria, sort, out totalRow, page.CurrentPage, page.PageSize, CurrenUser); _customerGrid.Pager.Init(totalRow); if (totalRow == 0) { _customerGrid.Data = new List <Customer>(); return; } _customerGrid.Data = customers; }
public ActionResult <List <CustomerResponseModel> > GetCustomers() { var customers = _customerServices.GetAll(); return(customers.Select(customer => new CustomerResponseModel(customer)).ToList()); }
public ActionResult Index() { ViewBag.GetAll = _customerServices.GetAll(); return(View()); }
public JsonResult GetAllCustomers() { return(Json(_customerServices.GetAll(), JsonRequestBehavior.AllowGet)); }