public async Task <IHttpActionResult> Posttbl_doithucanhtranh(tbl_doithucanhtranh tbl_doithucanhtranh)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tbl_doithucanhtranh.Add(tbl_doithucanhtranh);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (tbl_doithucanhtranhExists(tbl_doithucanhtranh.dt_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tbl_doithucanhtranh.dt_id }, tbl_doithucanhtranh));
        }
        public async Task <IHttpActionResult> Puttbl_doithucanhtranh(string id, tbl_doithucanhtranh tbl_doithucanhtranh)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_doithucanhtranh.dt_id)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tbl_doithucanhtranhExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> Gettbl_doithucanhtranh(string id)
        {
            tbl_doithucanhtranh tbl_doithucanhtranh = await db.tbl_doithucanhtranh.FindAsync(id);

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

            return(Ok(tbl_doithucanhtranh));
        }
        public async Task <IHttpActionResult> Deletetbl_doithucanhtranh(string id)
        {
            tbl_doithucanhtranh tbl_doithucanhtranh = await db.tbl_doithucanhtranh.FindAsync(id);

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

            db.tbl_doithucanhtranh.Remove(tbl_doithucanhtranh);
            await db.SaveChangesAsync();

            return(Ok(tbl_doithucanhtranh));
        }