public ActionResult Create(CustomerViewModel viewModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var id = _customerService.Add(viewModel.Name, viewModel.Surname, viewModel.TelephoneNumber, viewModel.Address);
             AddMessage(id > 0, "Customer added");
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View(viewModel);
     }
 }
        private CustomerViewModel GetCustomer(long id)
        {
            var customer = _customerService.GetById(id);
            if (customer == null)
                return null;

            var customerVm = new CustomerViewModel(customer);
            return customerVm;
        }
        // GET: Customer/Create
        public ActionResult Create()
        {
            var customer = new CustomerViewModel();

            return View(customer);
        }
 public ActionResult Edit(int id, CustomerViewModel viewModel)
 {
     try
     {
         if (viewModel != null)
         {
             var updated =_customerService.Update(id, viewModel.Name, viewModel.Surname, viewModel.TelephoneNumber, viewModel.Address);
             AddMessage(updated, "Customer updated");
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }