Esempio n. 1
0
        public async Task <ActionResult <AdminTemplate> > PostAdminTemplate(AdminTemplate AdminTemplate)
        {
            _context.AdminTemplate.Add(AdminTemplate);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAdminTemplate", new { id = AdminTemplate.Id }, AdminTemplate));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutAdminTemplate(int id, AdminTemplate AdminTemplate)
        {
            if (id != AdminTemplate.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }