Example #1
0
        public ActionResult Create(CustomerCRUDModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(model));
            }

            try
            {
                CustomerService.Create(model.Name);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);

                return(View(model));
            }

            return(RedirectToAction("Index", "Customer"));
        }
Example #2
0
        public ActionResult Edit(Guid id)
        {
            try
            {
                Customer customer = CustomerService.Get(id);

                CustomerCRUDModel model = new CustomerCRUDModel();
                model.Id               = customer.Id;
                model.Name             = customer.Name;
                model.CreatedDate      = customer.CreatedDate;
                model.LastModifiedDate = customer.LastModifiedDate;

                return(View(model));
            }
            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
Example #3
0
        public ActionResult Create()
        {
            CustomerCRUDModel model = new CustomerCRUDModel();

            return(View(model));
        }