/// <summary> /// Create a new Expense object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="gbpAmount">Initial value of the GbpAmount property.</param> /// <param name="transactionDate">Initial value of the TransactionDate property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="quantity">Initial value of the Quantity property.</param> public static Expense CreateExpense(global::System.Int32 id, global::System.Decimal gbpAmount, global::System.DateTime transactionDate, global::System.String description, global::System.Double quantity) { Expense expense = new Expense(); expense.Id = id; expense.GbpAmount = gbpAmount; expense.TransactionDate = transactionDate; expense.Description = description; expense.Quantity = quantity; return expense; }
public ActionResult Edit(Expense expense) { if (ModelState.IsValid) { db.ITransactions.Attach(expense); db.ObjectStateManager.ChangeObjectState(expense, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(expense); }