//GET /Home/Index public IActionResult Index() { var customers = _customerRepo.GetAllCustomers().Select(c => new CustomerViewModel { Id = c.CustomerId, FirstName = c.CustomerFirstName, LastName = c.CustomerLastName, FullName = c.CustomerFullName, PhoneNumber = c.PhoneNumber }); return(View(customers)); }
public void AddCustomer(Customer newCustomer) { List <Customer> getCustomers = repo.GetAllCustomers(); foreach (var customer in getCustomers) { if (customer.Name.Equals(newCustomer.Name)) { Log.Error($"Customer already exists. Name: {newCustomer.Name}"); throw new Exception($"\nCustomer name {newCustomer.Name} already exists. Not you? Please enter a unique name."); } } repo.AddACustomer(newCustomer); }
public IActionResult GetAllCustomers() { var customerList = _customerRepo.GetAllCustomers(); string data = JsonConvert.SerializeObject(customerList); return(Ok(data)); }
public List <Customer> GetAllCustomers() { try { return(_customerRepo.GetAllCustomers()); } catch (Exception ex) { throw; } }
//[ODataRoute("GetCustomersBySearchTerm)")] //[EnableQuery] public async Task <IActionResult> GetAllCustomers() { IEnumerable <Customer> customers = await _customerRepo.GetAllCustomers(); if (!customers.Any() || customers.Count() == 0) { return(NotFound(customers)); } return(Ok(customers)); //return Json(customers); }
public void UserRequestsAllCustomers() { var moq = new Mock <ICustomerRepo>(); moq.Setup(o => o.GetAllCustomers()).Returns(new List <Customer>() { customerOne }); customerRepo = moq.Object; customerList = customerRepo.GetAllCustomers(); }
public ActionResult <IEnumerable <Customer> > getAllCustomers() { var customerItems = _repository.GetAllCustomers(); return(Ok(_mapper.Map <IEnumerable <CustomerGetDto> >(customerItems))); }
public Task <HttpResponseMessage> GetCustomers() { return(_customerRepo.GetAllCustomers()); }
public List <Customer> GetAllCustomers() { List <Customer> customers = custRepo.GetAllCustomers(); return(customers); }
public ActionResult <IEnumerable <Customer> > GetAllCustomers(DateTime?startDate, DateTime?endDate) { var customers = _customerRepo.GetAllCustomers(startDate, endDate); return(Ok(_mapper.Map <IEnumerable <CustomerReadDto> >(customers))); }
public ActionResult <IEnumerable <CustomerReadDto> > GetAllCustomers() { var customers = _customer.GetAllCustomers(); return(Ok(_mapper.Map <IEnumerable <CustomerReadDto> >(customers))); }
public IEnumerable <Customer> GetAllCustomers() { return(_customerRepo.GetAllCustomers()); }
public HttpResponseMessage GetAllCustomers() { var customers = _customerRepo.GetAllCustomers(); return(Request.CreateResponse(HttpStatusCode.OK, customers)); }
public ActionResult <IEnumerable <Customer> > GetAllCustomers() { var custs = _repoCust.GetAllCustomers(); return(Ok(custs)); }
/// <summary> /// Returns list of all customers /// </summary> /// <returns></returns> public List <Customer> GetAllCustomers() { return(repo.GetAllCustomers()); }
public IActionResult CustomerList() { var model = _customerRepo.GetAllCustomers(); return(View(model)); }