Example #1
0
        public async Task <ActionResult <alerttype> > PostAlertType(alerttype alerttype)
        {
            _context.alerttype.Add(alerttype);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getalerttype", new { id = alerttype.alertTypeId }, alerttype));
        }
Example #2
0
        public async Task <IActionResult> PutAlertType(int id, alerttype alerttype)
        {
            if (id != alerttype.alertTypeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }