public ActionResult Semanal(string fecha, string format) { DateTime?date = null; IFormatProvider culture = new System.Globalization.CultureInfo("es-GT", true); if (!string.IsNullOrEmpty(fecha)) { date = DateTime.Parse(fecha, culture, System.Globalization.DateTimeStyles.AssumeLocal); } else { date = DateTime.Today; } var startDate = date.Value.AddDays(1 - (int)(date.Value.DayOfWeek)); var endDate = startDate.AddDays(4); result.Result = new { startDate = startDate, endDate = endDate }; result = _publicacionManager.GetPage(0, 0, e => e.fecha_publicacion >= startDate && e.fecha_publicacion <= endDate && e.fecha_publicacion <= DateTime.Today, order => order.fecha_publicacion); ViewBag.Many = true; var week = startDate.ToLongDateString() + " - " + endDate.ToLongDateString(); ViewBag.Week = week; if (!string.IsNullOrEmpty(format) && format == "pdf") { var rotativaOptions = new Rotativa.Core.DriverOptions() { CustomSwitches = "--print-media-type", PageOrientation = Rotativa.Core.Options.Orientation.Portrait, PageMargins = new Rotativa.Core.Options.Margins(1, 0, 1, 0), PageWidth = 215.9, PageHeight = 279.4 }; return(new Rotativa.MVC.ViewAsPdf("Semanal", ((PagedList)result.Result).DataSet) { FileName = "Gaceta_" + week + ".pdf", RotativaOptions = rotativaOptions }); } return(View(((PagedList)result.Result).DataSet)); }
public ActionResult EdictoAsPdf(int Id) { ViewBag.Many = false; result = _publicacionManager.Get(Id); var rotativaOptions = new Rotativa.Core.DriverOptions() { CustomSwitches = "--print-media-type", PageOrientation = Rotativa.Core.Options.Orientation.Portrait, PageMargins = new Rotativa.Core.Options.Margins(1, 0, 1, 0), PageWidth = 215.9, PageHeight = 279.4 }; return(new Rotativa.MVC.ViewAsPdf("Edicto", result.Result) { FileName = "Edicto" + Id.ToString() + ".Pdf", RotativaOptions = rotativaOptions }); }