public async Task <IHttpActionResult> PuttUserSleepDetail(int id, tUserSleepDetail tUserSleepDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GettUserSleepDetail(int id)
        {
            tUserSleepDetail tUserSleepDetail = await db.tUserSleepDetails.FindAsync(id);

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

            return(Ok(tUserSleepDetail));
        }
        public async Task <IHttpActionResult> PosttUserSleepDetail(tUserSleepDetail tUserSleepDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tUserSleepDetails.Add(tUserSleepDetail);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = tUserSleepDetail.ID }, tUserSleepDetail));
        }
        public async Task <IHttpActionResult> DeletetUserSleepDetail(int id)
        {
            tUserSleepDetail tUserSleepDetail = await db.tUserSleepDetails.FindAsync(id);

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

            db.tUserSleepDetails.Remove(tUserSleepDetail);
            await db.SaveChangesAsync();

            return(Ok(tUserSleepDetail));
        }