public IHttpActionResult PostDM_LOAI_DOI_TUONG(DM_LOAI_DOI_TUONG dM_LOAI_DOI_TUONG)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DM_LOAI_DOI_TUONG.Add(dM_LOAI_DOI_TUONG);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (DM_LOAI_DOI_TUONGExists(dM_LOAI_DOI_TUONG.MA_LOAI_DOI_TUONG))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = dM_LOAI_DOI_TUONG.MA_LOAI_DOI_TUONG }, dM_LOAI_DOI_TUONG));
        }
        public void PutDM_LOAI_DOI_TUONG(string id, DM_LOAI_DOI_TUONG dM_LOAI_DOI_TUONG)
        {
            var check = db.DM_LOAI_DOI_TUONG.Where(x => x.MA_LOAI_DOI_TUONG == id);

            if (check.Count() > 0)
            {
                var resultupdate = check.FirstOrDefault();
                resultupdate.TEN_LOAI_DOI_TUONG = dM_LOAI_DOI_TUONG.TEN_LOAI_DOI_TUONG;
                db.SaveChanges();
            }
        }
        public IHttpActionResult GetDM_LOAI_DOI_TUONG(string id)
        {
            DM_LOAI_DOI_TUONG dM_LOAI_DOI_TUONG = db.DM_LOAI_DOI_TUONG.Find(id);

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

            return(Ok(dM_LOAI_DOI_TUONG));
        }
        public IHttpActionResult DeleteDM_LOAI_DOI_TUONG(string id)
        {
            DM_LOAI_DOI_TUONG dM_LOAI_DOI_TUONG = db.DM_LOAI_DOI_TUONG.Find(id);

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

            db.DM_LOAI_DOI_TUONG.Remove(dM_LOAI_DOI_TUONG);
            db.SaveChanges();

            return(Ok(dM_LOAI_DOI_TUONG));
        }