[HttpGet("", Name = "GetCustomers")] // ./api/customers public IActionResult GetAll([FromQuery] CustomerListParameters listParameters) { if (listParameters.Page < 1) { return(UnprocessableEntity(new ValidationFailedResult("Page must be 1 or greater."))); } if (listParameters.Take < 1) { return(UnprocessableEntity(new ValidationFailedResult("Take must be 1 or greater."))); } if (listParameters.Take > 500) { return(UnprocessableEntity(new ValidationFailedResult("Take cannot be larger than 500."))); } var customers = _customerData.GetAll(listParameters); var models = customers.Select(c => new CustomerDisplayViewModel(c)); var pagination = new PaginationModel { Previous = CreateCustomersResourceUri(listParameters, -1), Next = CreateCustomersResourceUri(listParameters, 1) }; Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(pagination)); return(Ok(models)); }
public IActionResult Index() { var model = new HomePageViewModel(); model.Customers = _customerData.GetAll(); return(View(model)); }
public Order_Edit(ICustomerData customerData, IEmployeeData employeeData, IStatusData statusData, Order order) { Order = order; Customers = customerData.GetAll(); Employees = employeeData.GetAll(); Statuses = statusData.GetAll(); }
public ActionResult Create() { var model = new Application { Customers = customerDb.GetAll() }; return(View(model)); }
public ActionResult Create() { var model = new CustomerContract { Customers = customerDb.GetAll() }; model.StartDate = DateTime.Today; model.PaymentDate = DateTime.Today; return(View(model)); }
public async Task <IEnumerable <CustomerViewModel> > Get() { return(_mapper.Map <IEnumerable <CustomerViewModel> >(await _customerData.GetAll())); }
public Customer_Index(ICustomerData customerData) : base() { Customers = customerData.GetAll(); }