Exemple #1
0
        public async Task <ActionResult <Fiskmodell> > PostFiskmodell(Fiskmodell fiskmodell)
        {
            _context.Fiskar.Add(fiskmodell);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFiskmodell", new { id = fiskmodell.FiskID }, fiskmodell));
        }
Exemple #2
0
        public async Task <IActionResult> PutFiskmodell(int id, Fiskmodell fiskmodell)
        {
            if (id != fiskmodell.FiskID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }