public ActionResult DeleteConfirmed(int id) { BudgetAmount budgetAmount = db.BudgetAmounts.Find(id); db.BudgetAmounts.Remove(budgetAmount); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Update(int budgetAmountId, [FromBody] BudgetAmount model) { if (model == null || budgetAmountId != model.Id || !ModelState.IsValid) { return(BadRequest()); } _repo.Update(model); return(CreatedAtAction("Update", model)); }
public IActionResult Create([FromBody] BudgetAmount model) { if (model == null || !ModelState.IsValid) { return(BadRequest()); } _repo.Add(model); return(CreatedAtAction("Create", model)); }
public ActionResult Edit([Bind(Include = "ID,TotalAmount,BudgetCodeID,TimeStamp")] BudgetAmount budgetAmount) { if (ModelState.IsValid) { db.Entry(budgetAmount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BudgetCodeID = new SelectList(db.BudgetCodes, "ID", "BudgetCodeName", budgetAmount.BudgetCodeID); return(View(budgetAmount)); }
public ActionResult CreateBudgetAndAmount(BudgetCode budgetCode, BudgetAmount budgetAmount) { if (ModelState.IsValid) { db.BudgetAmounts.Add(budgetAmount); db.BudgetCodes.Add(budgetCode); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(budgetCode)); }
internal BudgetCodeWithAmount GetRecord(BudgetCode c, BudgetAmount p) => new BudgetCodeWithAmount() { Id = c.Id, Active = c.Active, BudgetCodeName = c.BudgetCodeName, DA = c.DA, TimeStamp = c.TimeStamp, Type = c.Type, BudgetAmountId = p.Id, TotalAmount = p.TotalAmount };
// GET: BudgetAmounts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BudgetAmount budgetAmount = db.BudgetAmounts.Find(id); if (budgetAmount == null) { return(HttpNotFound()); } return(View(budgetAmount)); }
// GET: BudgetAmounts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BudgetAmount budgetAmount = db.BudgetAmounts.Find(id); if (budgetAmount == null) { return(HttpNotFound()); } ViewBag.BudgetCodeID = new SelectList(db.BudgetCodes, "ID", "BudgetCodeName", budgetAmount.BudgetCodeID); return(View(budgetAmount)); }
public async Task <IActionResult> UpdateTotal(BudgetCodeWithAmount code) { if (!ModelState.IsValid) { return(View(code)); } var budget = new BudgetAmount() { BudgetCodeId = code.Id, TotalAmount = code.TotalAmount, }; var result = await _webApiCalls.CreateAsync(budget); return(RedirectToAction("Index")); }
public void EnterBudgetAmount() { BudgetAmount.SendKeys(ExcelOperation.GetData[4]); }