public ActionResult Create(Quotation quotation) { try { quotation.LastUpdated = DateTime.Now; // add to database table db.AddToQuotations(quotation); // save db.SaveChanges(); return RedirectToAction("Index"); } catch { return View("Error"); } }
/// <summary> /// Deprecated Method for adding a new object to the Quotations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToQuotations(Quotation quotation) { base.AddObject("Quotations", quotation); }
// // GET: /Quotations/Create public ActionResult Create() { var data = new Quotation(); return View(data); }
/// <summary> /// Create a new Quotation object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="quote">Initial value of the Quote property.</param> /// <param name="lastUpdated">Initial value of the LastUpdated property.</param> public static Quotation CreateQuotation(global::System.Int32 id, global::System.String quote, global::System.DateTime lastUpdated) { Quotation quotation = new Quotation(); quotation.Id = id; quotation.Quote = quote; quotation.LastUpdated = lastUpdated; return quotation; }