public IHttpActionResult PostTTNV(TTNV ttnv)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TTNVs.Add(ttnv);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TTNVExists(ttnv.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = ttnv.ID }, ttnv));
        }
        // PUT api/HumanResource/5
        public IHttpActionResult PutTTNV(string id, TTNV ttnv)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ttnv.ID)
            {
                return(BadRequest());
            }

            db.Entry(ttnv).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TTNVExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetTTNV(string id)
        {
            TTNV ttnv = db.TTNVs.Find(id);

            if (ttnv == null)
            {
                return(NotFound());
            }

            return(Ok(ttnv));
        }
        public IHttpActionResult DeleteTTNV(string id)
        {
            TTNV ttnv = db.TTNVs.Find(id);

            if (ttnv == null)
            {
                return(NotFound());
            }

            db.TTNVs.Remove(ttnv);
            db.SaveChanges();

            return(Ok(ttnv));
        }
Пример #5
0
 private void Main_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Control == true && e.KeyCode == Keys.F)
     {
         button9.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.C)
     {
         button10.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.T)
     {
         button11.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.B)
     {
         button12.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.O)
     {
         button8.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.F1)
     {
         Support.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.F2)
     {
         TTNV.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.F3)
     {
         Updates.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.F4)
     {
         Addac.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.F5)
     {
         Pass.PerformClick();
     }
     if (e.Control == true && e.KeyCode == Keys.X)
     {
         Logout.PerformClick();
     }
 }