Beispiel #1
0
        public async Task <IActionResult> PutSuplementsForm(int id, SuplementsForm suplementsForm)
        {
            if (id != suplementsForm.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #2
0
        public async Task <ActionResult <SuplementsForm> > PostSuplementsForm(SuplementsForm suplementsForm)
        {
            _context.SuplementsForm.Add(suplementsForm);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (SuplementsFormExists(suplementsForm.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetSuplementsForm", new { id = suplementsForm.Id }, suplementsForm));
        }