public IHttpActionResult Puttb_History(int id, tb_History tb_History) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tb_History.Id) { return(BadRequest()); } db.Entry(tb_History).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tb_HistoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { tb_History tb_History = db.tb_History.Find(id); db.tb_History.Remove(tb_History); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,NameSpace,Data")] tb_History tb_History) { if (ModelState.IsValid) { db.Entry(tb_History).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tb_History)); }
public ActionResult Create([Bind(Include = "Id,NameSpace,Data")] tb_History tb_History) { if (ModelState.IsValid) { db.tb_History.Add(tb_History); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tb_History)); }
public IHttpActionResult Gettb_History(int id) { tb_History tb_History = db.tb_History.Find(id); if (tb_History == null) { return(NotFound()); } return(Ok(tb_History)); }
public IHttpActionResult Posttb_History(tb_History tb_History) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tb_History.Add(tb_History); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tb_History.Id }, tb_History)); }
// GET: History/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tb_History tb_History = db.tb_History.Find(id); if (tb_History == null) { return(HttpNotFound()); } return(View(tb_History)); }
public IHttpActionResult Deletetb_History(int id) { tb_History tb_History = db.tb_History.Find(id); if (tb_History == null) { return(NotFound()); } db.tb_History.Remove(tb_History); db.SaveChanges(); return(Ok(tb_History)); }
public static void AddHistory(string Screen, string App, string Detail, string Ref) { try { using (DataClasses1DataContext db = new DataClasses1DataContext()) { //MessageBox.Show(Screen); tb_History hy = new tb_History(); hy.id = 0; hy.ScreenName = Screen; hy.ApplicationNme = App; hy.Detail = Detail; hy.RefNo = Ref; hy.CreateBy = System.Environment.UserName; hy.CreateDate = DateTime.Now; db.tb_Histories.InsertOnSubmit(hy); db.SubmitChanges(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }