示例#1
0
        public ActionResult Create(Customer customer)
        {
            if (ModelState.IsValid)
            {
                Facade.GetCustomerRepository().Create(customer);
                return RedirectToAction("Index");
            }

            CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel();
            return View(createEditCustomerViewModel);
        }
示例#2
0
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            else
            {
                CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel();
                Customer customer = Facade.GetCustomerRepository().Read((int)id);

                createEditCustomerViewModel.customerId = customer.customerId;
                createEditCustomerViewModel.firstName = customer.firstName;
                createEditCustomerViewModel.lastName = customer.lastName;
                createEditCustomerViewModel.streetName = customer.streetName;
                createEditCustomerViewModel.houseNumber = customer.houseNumber;
                createEditCustomerViewModel.zipcode = customer.zipcode;
                createEditCustomerViewModel.email = customer.email;
                createEditCustomerViewModel.country = customer.country;
                createEditCustomerViewModel.confirmEmail = customer.email;

                return View(createEditCustomerViewModel);
            }
        }
示例#3
0
        public ActionResult Edit(MovieShopDAL.Customer customer)
        {
            if (ModelState.IsValid)
            {
                Facade.GetCustomerRepository().Update(customer);
                return RedirectToAction("Index");
            }

            CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel();

            createEditCustomerViewModel.firstName = customer.firstName;
            createEditCustomerViewModel.lastName = customer.lastName;
            createEditCustomerViewModel.streetName = customer.streetName;
            createEditCustomerViewModel.houseNumber = customer.houseNumber;
            createEditCustomerViewModel.zipcode = customer.zipcode;
            createEditCustomerViewModel.confirmEmail = customer.email;
            createEditCustomerViewModel.email = customer.email;
            createEditCustomerViewModel.country = customer.country;

            return View(createEditCustomerViewModel);
        }
示例#4
0
 public ActionResult Create()
 {
     CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel();
     return View(createEditCustomerViewModel);
 }