Esempio n. 1
0
        public async Task <IActionResult> PutInjuryTypes(int id, InjuryTypes injuryTypes)
        {
            if (id != injuryTypes.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <InjuryTypes> > PostInjuryTypes(InjuryTypes injuryTypes)
        {
            _context.InjuryTypes.Add(injuryTypes);
            await _context.SaveChangesAsync();

            //return CreatedAtAction("GetInjuryTypes", new { id = injuryTypes.Id }, injuryTypes);
            return(Ok(injuryTypes));
        }