public ActionResult CreateEdit(ExpanseTypeViewModels model) { if (!Service.IsValid(model)) { ModelState.AddModelError("Fixed", "Vous avez choisi une valeur fixe. Le plafond est donc obligatoire"); } if (ModelState.IsValid && Service.IsValid(model)) { if (string.IsNullOrEmpty(model.Id)) { Service.Add(model); } else { Service.Edit(model); } return(RedirectToAction("Index")); } ViewBag.Tva = new SelectList(TvaService.GetAll(), "TVA_ID", "Name"); return(View("Create", model)); }
// GET: Tva public ActionResult Index() { return(View(Service.GetAll())); }