public ActionResult RelatorioStatus(RelatorioStatusModelView model) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account", null)); } if (ModelState.IsValid) { model.user = User.Identity.Name; model.status = Convert.ToInt16(model.statusb); if (model.Relatoriostatusid != 0) //update { ServiceRelatorioStatus.UpdaterelatorioStatus(model); } else //insert { ServiceRelatorioStatus.InsertrelatorioStatus(model); } return(Redirect(Domain.Util.config.UrlSite + "ReportStatus/RelatorioStatus")); } model.RelatoriosStatus = ServiceRelatorioStatus.getrelatorioStatus(); return(View(model)); }
public static void InsertrelatorioStatus(RelatorioStatusModelView model) { RelatorioStatus objretorno = new RelatorioStatus(); //faz o de para: objModelView para objEntity Mapper.CreateMap <RelatorioStatusModelView, RelatorioStatus>(); var objtpprod = Mapper.Map <RelatorioStatus>(model); RelatorioStatusRepository tpprod = new RelatorioStatusRepository(); tpprod.Add(objtpprod); tpprod.Save(); }
public ActionResult RelatorioStatus(Int16 id = 0) { var model = new RelatorioStatusModelView(); if (id != 0) { //busca as informações para edição model = ServiceRelatorioStatus.GetrelatorioStatusId(id); } model.RelatoriosStatus = ServiceRelatorioStatus.getrelatorioStatus(); return(View(model)); }
public static void UpdaterelatorioStatus(RelatorioStatusModelView model) { RelatorioStatus objretorno = new RelatorioStatus(); //faz o de para: objModelView para objEntity Mapper.CreateMap <RelatorioStatusModelView, RelatorioStatus>(); var objtpprod = Mapper.Map <RelatorioStatus>(model); objtpprod.Dataalt = DateTime.Now; RelatorioStatusRepository tpprod = new RelatorioStatusRepository(); tpprod.Edit(objtpprod); tpprod.Save(); }