public ShowTypesViewModel()
        {
            // I just want this here to be able to use LabelFor
            Type = new ComponentTypeViewModel();

            Types = new List<ComponentTypeViewModel>();
        }
Beispiel #2
0
        public ShowTypesViewModel()
        {
            // I just want this here to be able to use LabelFor
            Type = new ComponentTypeViewModel();

            Types = new List <ComponentTypeViewModel>();
        }
 public ActionResult AddComponentType()
 {
     var result = new ComponentTypeViewModel
     {
         AvailableCategories = AutoMapper.Mapper.Map<List<ComponentCategoryViewModel>>(_categoryRepo.Get())
     };
     return View(result);
 }
 public ActionResult AddComponentType(ComponentTypeViewModel model)
 {
     var newEntity = AutoMapper.Mapper.Map<ComponentType>(model);
     _typeRepo.Insert(newEntity);
     return RedirectToAction("ShowTypes");
 }
 public ActionResult EditType(ComponentTypeViewModel model)
 {
     var updatedEntity = AutoMapper.Mapper.Map<ComponentType>(model);
     _typeRepo.Update(updatedEntity);
     return RedirectToAction("ShowTypes");
 }