예제 #1
0
 public ActionResult AddCustomer(Customer customer)
 {
     if (ModelState.IsValid)
     {
         customerRepository.Add(customer);
         return RedirectToAction("Customer", "Home");
     }
     return View();
 }
예제 #2
0
        public ActionResult Customer()
        {
            try
            {
                Customer model = new Customer();

                model.ListofCustomers = customerRepository.Get();
                model.Cards = GetCards();

                return View(model);
            }
            catch (Exception ex)
            {
                logger.Error("Error while getting a customer details. Error Details are: " + ex.Message);
                return RedirectToAction("Index", "Error");
            }
        }
예제 #3
0
        public ActionResult AddCustomer(Customer customer)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    customerRepository.Add(customer);
                    return new JavaScriptResult { Script = "alert('Customer added sucessfully');" };
                }

            }
            catch (Exception ex)
            {
                logger.Error("Error while adding a customer. Error Details are: " + ex.Message);
                return new JavaScriptResult { Script = "alert('Error while adding customer');" };
            }
            return View();
        }
예제 #4
0
        public void Add(Customer customer)
        {
            try
            {
                CustomerData cd = new CustomerData();
                cd.FirstName = customer.FirstName;
                cd.LastName = customer.LastName;
                cd.MobileNumber = customer.MobileNumber;
                cd.Email = customer.Email;
                cd.Address = customer.Address;
                cd.cardId = customer.CardId;

                client.AddCustomer(cd);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
        public ActionResult Customer()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            Customer model = new Customer();

            model.ListofCustomers = customerRepository.Get();
            model.Cards = GetCards();

            return View(model);
        }