// // GET: /Admin/MasterFunds/Edit/5 public ActionResult Edit(int id) { MasterFund masterfund = db.MasterFunds.Single(m => m.Id == id); ViewBag.CurrencyCode = new SelectList(db.Currencies.OrderBy(f => f.Id), "Id", "Id", masterfund.CurrencyCode); return(View(masterfund)); }
public ActionResult DeleteConfirmed(int id) { MasterFund masterfund = db.MasterFunds.Single(m => m.Id == id); db.MasterFunds.DeleteObject(masterfund); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(MasterFund masterfund) { masterfund.CurrencyCode = masterfund.CurrencyCode.ToUpper(); if (ModelState.IsValid) { db.MasterFunds.Attach(masterfund); db.ObjectStateManager.ChangeObjectState(masterfund, EntityState.Modified); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CurrencyCode = new SelectList(db.Currencies.OrderBy(f => f.Id), "Id", "Id", masterfund.CurrencyCode); return(View(masterfund)); }
public ActionResult Create(MasterFund masterfund) { masterfund.CurrencyCode = masterfund.CurrencyCode.ToUpper(); if (ModelState.IsValid) { db.MasterFunds.AddObject(masterfund); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CurrencyCode = new SelectList(db.Currencies.OrderBy(f => f.Id), "Id", "Id", masterfund.CurrencyCode); return(View(masterfund)); }
public static void CreateFund(string MasterName, string FundName, DateTime from, DateTime to, decimal Amount, string curr) { ccEntities context = new ccEntities(); var ms = context.MasterFunds.Where(m => m.Name == MasterName); int ms_id = 0; if (!ms.Any()) { MasterFund mf = new MasterFund(); mf.Name = MasterName; mf.StartDate = from; mf.EndDate = to; mf.Amount = Amount; mf.CurrencyCode = curr; context.MasterFunds.AddObject(mf); context.SaveChanges(); ms = context.MasterFunds.Where(m => m.Name == MasterName); } ms_id = ms.First().Id; var fn = context.Funds.Where(m => m.Name == FundName && m.MasterFundId == ms_id); if (!fn.Any()) { Fund f = new Fund(); f.Name = FundName; f.StartDate = from; f.EndDate = to; f.Amount = Amount; f.CurrencyCode = curr; f.MasterFundId = ms_id; context.Funds.AddObject(f); context.SaveChanges(); } }
// // GET: /Admin/MasterFunds/Delete/5 public ActionResult Delete(int id) { MasterFund masterfund = db.MasterFunds.Single(m => m.Id == id); return(View(masterfund)); }
// // GET: /Admin/MasterFunds/Details/5 public ViewResult Details(int id) { MasterFund masterfund = db.MasterFunds.Single(m => m.Id == id); return(View(masterfund)); }