public async Task <ActionResult> DeleteConfirmed(int id) { tb_sales_transactions tb_sales_transactions = await db.tb_sales_transactions.FindAsync(id); db.tb_sales_transactions.Remove(tb_sales_transactions); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ID,DatePosted,RecNo,US_Dollars,BritishPounds,Yen,CFA,Euro,CanDollar,Rate,TotalAmount,UserPosted,UserModified")] tb_sales_transactions tb_sales_transactions) { if (ModelState.IsValid) { db.Entry(tb_sales_transactions).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tb_sales_transactions)); }
// GET: tb_sales_transactions/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tb_sales_transactions tb_sales_transactions = await db.tb_sales_transactions.FindAsync(id); if (tb_sales_transactions == null) { return(HttpNotFound()); } return(View(tb_sales_transactions)); }
public HttpResponseMessage Post(FormDataCollection form) { var values = form.Get("values"); var sales = new tb_sales_transactions(); JsonConvert.PopulateObject(values, sales); sales.UserPosted = "kris"; Validate(sales); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } db.tb_sales_transactions.Add(sales); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created)); }