예제 #1
0
        public async Task <ActionResult <tbOpSubject> > PostOpSubject(tbOpSubject Ops)
        {
            _context.OpSubjects.Add(Ops);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOpSubject", new { id = Ops.SubjectID }, Ops));
        }
예제 #2
0
        public async Task <IActionResult> PutOpSubject(string id, tbOpSubject Ops)
        {
            if (id != Ops.SubjectID)
            {
                return(BadRequest());
            }

            _context.Entry(Ops).State = EntityState.Modified;

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

            return(NoContent());
        }