public async Task <IHttpActionResult> PutDay(int id, [FromBody] Day day)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //if requested day is not in a class the user owns
            if (!IdService.isValidDayId(id, db, User))
            {
                return(BadRequest("invalid day id for the given user"));
            }

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

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

            return(StatusCode(HttpStatusCode.OK));
        }
        public async Task <IHttpActionResult> DeleteDay(int id)
        {
            Day day = await db.Days.FindAsync(id);

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

            //if requested day is not in a class the user owns
            if (!IdService.isValidDayId(id, db, User))
            {
                return(BadRequest("invalid day id for the given user"));
            }

            db.Days.Remove(day);
            await db.SaveChangesAsync();

            return(Ok(day));
        }