Esempio n. 1
0
        public async Task <ActionResult <AssignCategories> > PostAssignCategories(AssignCategories assignCategories)
        {
            _context.AssignCategories.Add(assignCategories);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAssignCategories", new { id = assignCategories.AssignCategoryId }, assignCategories));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutAssignCategories(int id, AssignCategories assignCategories)
        {
            if (id != assignCategories.AssignCategoryId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }