예제 #1
0
        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));
        }
예제 #2
0
        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"));
        }
예제 #3
0
 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));
 }
예제 #4
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
        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));
        }
예제 #7
0
        // 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));
        }
예제 #8
0
        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));
        }
예제 #9
0
 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); }
 }