public ActionResult Index(string Id, HistoryModel hm) { var h_p_detail = ppty.GetProperty(Id); var _hm = new BsonDocument().Add("pricehistory",hm.PriceHistory). Add("hdate",hm.HDate). Add("event", hm.Event). Add("source", hm.Source); if (h_p_detail.ToString().Contains("PriceHistory")) { h_p_detail.ToBsonDocument()["PriceHistory"].AsBsonArray.Add(BsonValue.Create(_hm)); } else { h_p_detail.ToBsonDocument()["PriceHistory"] = new BsonArray().Add(BsonValue.Create(_hm)); } // TODO: Add update logic here // ppty.SaveProperty(Id); ppty.SaveProperty(h_p_detail); return RedirectToAction("Index", new { Id = Id }); }
public ActionResult Edit(string Id,HistoryModel _hm) { try { return RedirectToAction("Index", new { Id = Id }); } catch { return View(); } }