public JsonResult CreateQuote(string jsonString) { WorkFromView works = JsonConvert.DeserializeObject <WorkFromView>(jsonString); int locationId = WorkLocation.CheckAndUpdateLocation(works.ContactDetails.ClubId, works.ContactDetails.ClubAddress, works.ContactDetails.ClubName); int contactId = Contact.CheckAndUpdateContact(works.ContactDetails.ContactId, works.ContactDetails.ContactName, works.ContactDetails.ContactEmail, works.ContactDetails.ContactNumber, locationId); Quote.CreateQuote(works.QuoteRef, locationId, contactId, works.QuoteDate, works.CourtWorkDetails); return(Json(new { Success = true, Message = "Quoted work added" }, JsonRequestBehavior.AllowGet)); }
// GET: /Quote/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Quote quote = m_DbContext.Quotes.Find(id); if (quote == null) { return(HttpNotFound()); } WorkFromView model = new WorkFromView() { QuoteRef = quote.QuoteId, QuoteDate = quote.QuoteDate.ToString("dd-MM-yyyy"), ContactDetails = new ContactDetails(quote.Contact, quote.WorkLocation), CourtWorkDetails = CourtWorkDetail.GetCourtWorkDetails(quote.QuotedWorks.ToList()) }; //string header = ToHtml("_PdfHeader", new ViewDataDictionary{ {"QuoteRef", model.QuoteRef}, {"QuoteDate", model.QuoteDate}}); //string footer = ToHtml("_PdfFooter", new ViewDataDictionary()); //string cusomtSwitches = string.Format("--print-media-type --footer-center {0} --footer-spacing -10 --header-center {1} --header-spacing -10",footer, header); return(View(model)); //return new ViewAsPdf(model) //{ // FileName = quote.QuoteId, // PageSize = Size.A4, // PageOrientation = Orientation.Portrait, // PageMargins = { Left = 15, Bottom = 15, Right = 15, Top = 15 }, // IsLowQuality = false, // MinimumFontSize = 14, // CustomSwitches = cusomtSwitches //}; }