public ActionResult DeleteConfirmed(int id) { AllocationChange allocationChange = (AllocationChange)db.ChangeEvents.Find(id); db.ChangeEvents.Remove(allocationChange); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,EffectiveDateTime,Amount,ChangeTypeEnum,Recurance,AllocationId,IsRecurring")] AllocationChange allocationChange) { if (ModelState.IsValid) { db.Entry(allocationChange).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AllocationId = new SelectList(db.Allocations, "Id", "Name", allocationChange.AllocationId); return(View(allocationChange)); }
public ActionResult Create([Bind(Include = "Id,EffectiveDateTime,Amount,ChangeTypeEnum,Recurance,AllocationId,IsRecurring")] AllocationChange allocationChange) { if (ModelState.IsValid) { db.ChangeEvents.Add(allocationChange); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AllocationId = new SelectList(db.Allocations, "Id", "Name", allocationChange.AllocationId); return(View("~/Views/Budget/Index.cshtml")); }
// GET: AllocationChanges/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AllocationChange allocationChange = (AllocationChange)db.ChangeEvents.Find(id); if (allocationChange == null) { return(HttpNotFound()); } return(View(allocationChange)); }
// GET: AllocationChanges/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AllocationChange allocationChange = (AllocationChange)db.ChangeEvents.Find(id); if (allocationChange == null) { return(HttpNotFound()); } ViewBag.AllocationId = new SelectList(db.Allocations, "Id", "Name", allocationChange.AllocationId).OrderBy(x => x.Text); return(View(allocationChange)); }
// GET: AllocationChanges/Create public ActionResult Create(int?AllocationId) { ViewBag.AllocationId = new SelectList(db.Allocations, "Id", "Name").OrderBy(x => x.Text); AllocationChange change = new AllocationChange(); if (AllocationId != null) { //change.AllocationId = (int)AllocationId; change.Allocation = db.Allocations.Find(AllocationId); } change.EffectiveDateTime = DateTime.Now; change.ChangeTypeEnum = Models.Enums.ChangeTypeEnum.LumpSum; return(View(change)); }