public IActionResult GetById(long id) { var item = _custRepo.Find(id); if (item == null) { return(NotFound()); } return(new ObjectResult(item)); }
public CartWithCustomerInfo GetShoppingCartRecordsWithCustomer(int customerId) { return(new CartWithCustomerInfo() { CartRecords = GetShoppingCartRecords(customerId).ToList(), Customer = _customerRepo.Find(customerId) }); }
public ActionResult <Customer> Get(int id) { var item = _repo.Find(id); if (item == null) { return(NotFound()); } return(Ok(item)); }
public IActionResult Get(int id) { var item = _repo.Find(id); if (item == null) { return(NotFound()); } return(new ObjectResult(item)); }
public ActionResult <Customer> Get(int id) { Customer customer = _repo.Find(id); if (customer == null) { return(NotFound()); } return(Ok(customer)); }
public async Task <IActionResult> GetCustomer([FromRoute] int id) { if (await CustomerExists(id)) { var customer = await _customerRepository.Find(id); return(Ok(customer)); } else { return(NotFound()); } }
public IActionResult Index([FromServices] ICustomerRepo customerRepo, int customerId) { ViewBag.Title = "Cart"; ViewBag.Header = "Cart"; var cartItems = _shoppingCartRepo.GetShoppingCartRecords(customerId); var customer = customerRepo.Find(customerId); var mapper = _config.CreateMapper(); var viewModel = new CartViewModel { Customer = customer, CartRecords = mapper.Map <IList <CartRecordViewModel> >(cartItems) }; return(View(viewModel)); }
public CartWithCustomerInfo GetShoppingCartRecordsWithCustomer(int customerId) => new CartWithCustomerInfo() { cartRecord = GetShoppingCartRecords(customerId).ToList(), Customer = _customerRepo.Find(customerId) };
public Customer Find(int id) { return(_customerRepo.Find(id)); }