Exemplo n.º 1
0
        public ActionResult <Customer> GetById(int id)
        {
            if (id == 0)
            {
                return(null);
            }
            var customer = _customerModel.GetCustomerById(id);

            return(Ok(customer));
        }
Exemplo n.º 2
0
        public void TestGetCustomerById()
        {
            var customer   = new Customer("Adam", "Hansen", "Test");
            var customerId = customer.Id;

            _customerModel.AddCustomer(customer);

            var customerFromModel = _customerModel.GetCustomerById(customerId);

            Assert.IsTrue(customer.Id == customerFromModel.Id);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Give user option to edit a customer
        /// </summary>
        private static void DisplayEditCustomer()
        {
            ListAllCustomers();

            Console.WriteLine();

            if (CustomerModel.GetCustomers().Any())
            {
                Console.WriteLine("Please write id of customer to edit:");

                var customerIdInput = MenuManager.GetSelectedCustomerId(CustomerModel.GetCustomers());

                var selectedCustomer = CustomerModel.GetCustomerById(customerIdInput);

                CustomerManager.EditCustomer(selectedCustomer);

                Console.WriteLine("New customer info:");

                selectedCustomer.DisplayInfo();
            }
        }
Exemplo n.º 4
0
        // GET: CustomerMaster/Edit/5
        public ActionResult Edit(int id)
        {
            var moveToList = new List<SelectListItem>();
            MoveToModel moveModel = new MoveToModel();

            moveModel.MoveTo = "AMC Customer";
            moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo });

            moveModel = new MoveToModel();
            moveModel.MoveTo = "Warranty List";
            moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo });

            moveModel = new MoveToModel();
            moveModel.MoveTo = "MAC Inprocess";
            moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo });

            moveModel = new MoveToModel();
            moveModel.MoveTo = "Inactive Customer";
            moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo });
            ViewBag.MoveToList = moveToList;
            CustomerModel cm = new CustomerModel();
            cm = cm.GetCustomerById(id);
            cm.listMoveTo = moveToList;
            return View(cm);
        }
Exemplo n.º 5
0
 // GET: CustomerMaster/Details/5
 public ActionResult Details(int id)
 {
     CustomerModel cm = new CustomerModel();
     cm = cm.GetCustomerById(id);
     return View(cm);
 }
 public ActionResult Details(int id)
 {
     return(View(customerModel.GetCustomerById(id)));
 }