Example #1
0
        public async Task <ActionResult <Hclass> > PostHclass(Hclass hclass)
        {
            _context.Hclass.Add(hclass);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHclass", new { id = hclass.Hclassid }, hclass));
        }
Example #2
0
        public async Task <IActionResult> PutHclass(int id, Hclass hclass)
        {
            if (id != hclass.Hclassid)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }