Beispiel #1
0
        public ActionResult Create(Fabricante_vm f)
        {
            if (ModelState.IsValid)
            {
                Fabricante fab = Mapper.Map <Fabricante_vm, Fabricante>(f);
                repo.CadastrarFabricante(fab);
                return(RedirectToAction("Index"));
            }

            return(View(f));
        }
Beispiel #2
0
        public ActionResult Edit(Fabricante_vm f)
        {
            Fabricante fabricante = Mapper.Map <Fabricante_vm, Fabricante>(f);

            if (ModelState.IsValid)
            {
                repo.ModificarFabricante(fabricante);

                return(RedirectToAction("Index"));
            }
            return(View(fabricante));
        }
Beispiel #3
0
        // GET: Fabricantes

        public ActionResult Index()
        {
            List <Fabricante>    veic   = repo.LerTodosFabricante();
            List <Fabricante_vm> veicVM = new List <Fabricante_vm>();

            foreach (var item in veic)
            {
                Fabricante_vm f = Mapper.Map <Fabricante, Fabricante_vm>(item);
                veicVM.Add(f);
            }

            return(View(veicVM));
        }
Beispiel #4
0
        // GET: Fabricantes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Fabricante    fabricante = repo.LerFabricante(id);
            Fabricante_vm f          = Mapper.Map <Fabricante, Fabricante_vm>(fabricante);

            if (f == null)
            {
                return(HttpNotFound());
            }
            return(View(f));
        }