public override ActionResult AfterCreate(VisitanteAcessoViewModel value, FormCollection collection) { if (!value.IsPortaria) { try { FactoryLocalhost <VisitanteAcessoViewModel, ApplicationContext> factory = new FactoryLocalhost <VisitanteAcessoViewModel, ApplicationContext>(); EmailPortariaBI bi = new EmailPortariaBI(); value.uri = this.ControllerContext.Controller.GetType().Name.Replace("Controller", "") + "/" + this.ControllerContext.RouteData.Values["action"].ToString(); VisitanteAcessoViewModel a = factory.Execute(new EmailPortariaBI(), value); if (a.mensagem.Code > 0) { throw new Exception(a.mensagem.Message); } } catch (Exception ex) { Error(ex.Message); } } Facade <VisitanteAcessoViewModel, VisitanteAcessoModel, ApplicationContext> facade = new Facade <VisitanteAcessoViewModel, VisitanteAcessoModel, ApplicationContext>(); GetCreate(); value = facade.CreateRepository(Request); value.Interfona = collection["Interfona"]; value.HoraInicio = collection["HoraInicio"]; value.HoraLimite = collection["HoraLimite"]; value.Observacao = collection["Observacao"]; value.DataAutorizacao = Convert.ToDateTime(collection["DataAutorizacao"]); value.AluguelID = int.Parse(collection["AluguelID"]); ViewBag.AluguelID = int.Parse(collection["AluguelID"]);; ViewBag.DataEvento = Convert.ToDateTime(collection["DataAutorizacao"]);; return(RedirectToAction("Create", new { value.AluguelID, DataEvento = value.DataAutorizacao.ToString("yyyy-MM-dd") })); }
public override ActionResult AfterCreate(VisitanteAcessoViewModel value, FormCollection collection) { if (!value.IsPortaria) { try { FactoryLocalhost <VisitanteAcessoViewModel, ApplicationContext> factory = new FactoryLocalhost <VisitanteAcessoViewModel, ApplicationContext>(); EmailPortariaBI bi = new EmailPortariaBI(); value.uri = this.ControllerContext.Controller.GetType().Name.Replace("Controller", "") + "/" + this.ControllerContext.RouteData.Values["action"].ToString(); VisitanteAcessoViewModel a = factory.Execute(new EmailPortariaBI(), value); if (a.mensagem.Code > 0) { throw new Exception(a.mensagem.Message); } } catch (Exception ex) { Error(ex.Message); } } return(RedirectToAction("Browse")); }