예제 #1
0
        public ActionResult Create(PeriodoViewModel vm)
        {
            try
            {
                var periodo = Periodo.FromViewModel(vm);
                service.Add(periodo);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
예제 #2
0
        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));
            }
        }