public ActionResult Create(PeriodoViewModel vm) { try { var periodo = Periodo.FromViewModel(vm); service.Add(periodo); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(int id, PeriodoViewModel vm) { var periodo = Periodo.FromViewModel(vm); try { service.Update(id, periodo); return(RedirectToAction(nameof(Index))); } catch { return(View(periodo)); } }