public ShowComponentsViewModel()
        {
            // I just want this here to be able to use LabelFor
            Component = new ComponentViewModel();

            Components = new List<ComponentViewModel>();
        }
Exemplo n.º 2
0
        public ShowComponentsViewModel()
        {
            // I just want this here to be able to use LabelFor
            Component = new ComponentViewModel();

            Components = new List <ComponentViewModel>();
        }
Exemplo n.º 3
0
 public ActionResult AddComponent()
 {
     var result = new ComponentViewModel
     {
         AvailableTypes = AutoMapper.Mapper.Map<List<ComponentTypeViewModel>>(_typeRepo.Get())
     };
     return View(result);
 }
Exemplo n.º 4
0
 public ActionResult AddComponent(ComponentViewModel model)
 {
     var newEntity = AutoMapper.Mapper.Map<Component>(model);
     _componentRepo.Insert(newEntity);
     return RedirectToAction("ShowComponents");
 }
Exemplo n.º 5
0
 public ActionResult SearchComponent(ComponentViewModel model)
 {
     var comp = _componentRepo.Get().FirstOrDefault(x => x.ComponentNumber == model.ComponentNumber);
     var result = AutoMapper.Mapper.Map<ComponentViewModel>(comp);
     if (result != null)
     {
         return View("Details", result);
     }
     ViewBag.Message = "Component could not be found.";
     return RedirectToAction("Error");
 }
Exemplo n.º 6
0
 public ActionResult EditComponent(ComponentViewModel model)
 {
     var updatedEntity = AutoMapper.Mapper.Map<Component>(model);
     _componentRepo.Update(updatedEntity);
     return RedirectToAction("ShowComponents");
 }