public ActionResult Save(EditViewModel editViewModel)
 {
     if (ModelState.IsValid)
     {
         _customersManagement.Save(editViewModel);
         return RedirectToAction("Index");
     }
     return View("Edit", editViewModel);
 }
        public void Save(EditViewModel editViewModel)
        {
            var customer = Map(editViewModel);

            if (editViewModel.CustomerId.Equals(0))
            {
                AddCustomer(customer);
            }
            else
            {
                EditCustomer(customer);
            }
        }
        public ActionResult Create()
        {
            var editViewModel = new EditViewModel
                {
                    CustomerId = 0,
                    Boss = string.Empty,
                    CedNumber = string.Empty,
                    FName = string.Empty,
                    LName = string.Empty,
                    PhoneNumber = string.Empty,
                    Possition = string.Empty,
                    Salary = string.Empty

                };
            return View("Edit", editViewModel);
        }
        private static Customer Map(EditViewModel editViewModel)
        {
            var customer = new Customer
                               {
                                   CustomerId = editViewModel.CustomerId,
                                   Boss = editViewModel.Boss,
                                   CedNumber = editViewModel.CedNumber,
                                   FName = editViewModel.FName,
                                   LName = editViewModel.LName,
                                   PhoneNumber = editViewModel.PhoneNumber,
                                   Possition = editViewModel.Possition,
                                   Salary = editViewModel.Salary,
                                   LaboralTime = editViewModel.LaboralTime,
                                   CreatedAt = editViewModel.CreatedAt
                               };

            return customer;
        }
 private EditViewModel Map(Customer customer)
 {
     var editViewModel = new EditViewModel
                             {
                                 CustomerId = customer.CustomerId,
                                 FName = customer.FName,
                                 LName = customer.LName,
                                 Boss = customer.Boss,
                                 CedNumber = customer.CedNumber,
                                 PhoneNumber = customer.PhoneNumber,
                                 Possition = customer.Possition,
                                 Salary = customer.Salary,
                                 LaboralTime = customer.LaboralTime,
                                 CreatedAt = customer.CreatedAt
                             };
     return editViewModel;
 }