Пример #1
0
        public async Task <IActionResult> PutGroup(long id, Group @group)
        {
            if (id != @group.Id)
            {
                return(BadRequest());
            }

            _context.Entry(@group).State = EntityState.Modified;

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

            return(NoContent());
        }
 public async Task CreateAsync([FromBody] Product_Group item)
 {
     try
     {
         _context.Product_Group.Add(item);
         await _context.SaveChangesAsync();
     }catch (Exception ex) {
         throw new Exception(ex.Message);
     }
 }