예제 #1
0
 public virtual ActionResult Create(TViewModel vm)
 {
     if (ModelState.IsValid)
     {
         var entity = new TEntity();
         converter.ViewmodelToEntity(vm, ref entity);
         service.Add(entity);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(vm));
     }
 }
예제 #2
0
        public ActionResult Create(LicenseViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var license = new License();
                converter.ViewmodelToEntity(vm, ref license);
                service.Add(license);

                return(RedirectToAction("Edit", "Customer", new { id = vm.CustomerId }));
            }
            else
            {
                return(View(vm));
            }
        }