public async Task <ActionResult <SetTerm> > PutSetTerms(int id, int termId, [FromBody] SetTermIM st)
        {
            var set = await _context.Sets.FindAsync(id);

            if (set == null)
            {
                return(NotFound("set not found"));
            }
            var @term = await _context.SetTerms.FindAsync(termId);

            if (@term == null)
            {
                return(NotFound("term not found"));
            }
            if (term.SetId != set.Id)
            {
                return(BadRequest("term is not in this set"));
            }
            if (st.WarningDate == default)
            {
                st.WarningDate = st.Date.AddDays(-2);
            }
            term.Name        = st.Name;
            term.Date        = st.Date;
            term.WarningDate = st.WarningDate;
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSetTerm", new { id = term.SetId, termId = term.Id }, id));
        }
        public async Task <ActionResult <SetTerm> > PostSetTerms(int id, [FromBody] SetTermIM st)
        {
            var set = await _context.Sets.FindAsync(id);

            if (set == null)
            {
                return(NotFound("set not found"));
            }
            if (st.WarningDate == default)
            {
                st.WarningDate = st.Date.AddDays(-2);
            }
            var newTerm = new SetTerm {
                SetId = id, Name = st.Name, Date = st.Date, WarningDate = st.WarningDate
            };

            _context.SetTerms.Add(newTerm);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSetTerm", new { id = newTerm.SetId, termId = newTerm.Id }, newTerm));
        }