public ActionResult Reposo(int id) { try { reposo reposo = db.reposo.Find(id); if (reposo == null) { return(RedirectToAction("Message", "Home", new { mensaje = "La historia no tiene certificado de reposo" })); } dsReposo dsReposo = new dsReposo(); string conn = ConfigurationManager.AppSettings["conexion"]; SqlConnection sqlcon = new SqlConnection(conn); historia historia = db.historia.Find(id); string strReposo = "Select top 1 * from view_reposo where his_id=" + id; SqlDataAdapter daReposo = new SqlDataAdapter(strReposo, sqlcon); daReposo.Fill(dsReposo, "view_reposo"); RptReposo rp = new RptReposo(); string reportPath = Server.MapPath("~/Reports/RptReposo.rpt"); rp.Load(reportPath); rp.SetDataSource(dsReposo); rp.SetParameterValue("fecha", get_fecha(historia.his_fecha)); Stream stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Certificado.pdf")); } catch (Exception ex) { return(RedirectToAction("Message", "Home", new { mensaje = ex.Message + ex.InnerException })); } }
public ActionResult DeleteConfirmed(int id) { reposo reposo = db.reposo.Find(id); db.reposo.Remove(reposo); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Reposo/Details/5 public ActionResult Details(int id = 0) { reposo reposo = db.reposo.Find(id); if (reposo == null) { return(HttpNotFound()); } return(View(reposo)); }
public ActionResult Edit(reposo reposo) { if (ModelState.IsValid) { db.Entry(reposo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Message", "Home", new { mensaje = "Datos Guardados" })); } ViewBag.rep_id = reposo.rep_id; return(PartialView(reposo)); }
// // GET: /Reposo/Edit/5 public ActionResult Edit(int id = 0) { reposo reposo = db.reposo.Find(id); if (reposo == null) { return(RedirectToAction("Create", new { id = id })); } ViewBag.rep_id = reposo.rep_id; return(PartialView(reposo)); }
// // GET: /Reposo/Create public ActionResult Create(int id) { reposo reposo = db.reposo.Find(id); if (reposo != null) { return(RedirectToAction("Edit", new { id = id })); } ViewBag.rep_id = id; return(PartialView()); }
public ActionResult Create(reposo reposo) { if (ModelState.IsValid) { db.reposo.Add(reposo); db.SaveChanges(); return(RedirectToAction("Message", "Home", new { mensaje = "Datos Guardados" })); } ViewBag.rep_id = reposo.rep_id; return(PartialView(reposo)); }