Ejemplo n.º 1
0
        public ActionResult Add()
        {
            var viewmodel = new SuppliersBaseViewModel();

            viewmodel.Init(_suppliersRepository);

            return(View(viewmodel));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(SuppliersBaseViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var supplier = viewModel.Supplier;

                _suppliersRepository.Update(supplier);

                TempData["Message"] = "Le fournisseur a été modifié correctement.";

                return(RedirectToAction("Index"));
            }

            viewModel.Init(_suppliersRepository);

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public ActionResult Add(SuppliersBaseViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var supplier = viewModel.Supplier;

                _suppliersRepository.Add(supplier);

                TempData["Message"] = "Le fournisseur a été ajouté a la liste.";

                return(RedirectToAction("Index"));
            }

            viewModel.Init(_suppliersRepository);

            return(View(viewModel));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var supplier = _suppliersRepository.GetById((int)id);


            if (supplier == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new SuppliersBaseViewModel()
            {
                Supplier = supplier
            };

            viewModel.Init(_suppliersRepository);

            return(View(viewModel));
        }