public async Task <ActionResult> DeleteChargeConfirmed(int id) { DbCharge dbCharge = await db.Charges.FindAsync(id); db.Charges.Remove(dbCharge); await db.SaveChangesAsync(); return(RedirectToAction("Charges")); }
public ChargeModel(DbCharge dbCharge) { this.Id = dbCharge.ChargeId; this.BilledAmount = dbCharge.BilledAmount; this.Description = dbCharge.Description; this.ExpenseDate = dbCharge.ExpenseDate; this.Location = dbCharge.Location; this.Merchant = dbCharge.Merchant; this.Notes = dbCharge.Notes; this.TransactionAmount = dbCharge.TransactionAmount; }
public Charge(DbCharge dbCharge) { this.BilledAmount = dbCharge.BilledAmount; this.ChargeId = dbCharge.ChargeId; this.Description = dbCharge.Description; this.EmployeeId = dbCharge.EmployeeId; this.ExpenseDate = dbCharge.ExpenseDate; this.ExpenseReportId = dbCharge.ExpenseReportId; this.Location = dbCharge.Location; this.Merchant = dbCharge.Merchant; this.Notes = dbCharge.Notes; this.TransactionAmount = dbCharge.TransactionAmount; }
// GET: Expenses/DeleteCharge/5 public async Task <ActionResult> DeleteCharge(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DbCharge dbCharge = await db.Charges.FindAsync(id); if (dbCharge == null) { return(HttpNotFound()); } return(View(new ChargeModel(dbCharge))); }
public DbCharge ConvertToDbCharge(int employeeId) { DbCharge dbCharge = new DbCharge() { ChargeId = this.Id, BilledAmount = this.BilledAmount, Description = this.Description, EmployeeId = employeeId, ExpenseDate = this.ExpenseDate, Location = this.Location, Merchant = this.Merchant, Notes = this.Notes, TransactionAmount = this.TransactionAmount, }; return(dbCharge); }
// GET: Expenses/Charge/5 public async Task <ActionResult> Charge(int?id) { var employee = await this.GetEmployee(); var employeeId = employee.Item1; ViewBag.UserName = employee.Item2; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DbCharge dbCharge = await db.Charges.FindAsync(id); if (dbCharge == null) { return(HttpNotFound()); } return(View(new ChargeModel(dbCharge))); }