Пример #1
0
        public async Task <ActionResult <MucDoHaiLong> > PostMucDoHaiLong(MucDoHaiLong mucDoHaiLong)
        {
            _context.MucDoHaiLongs.Add(mucDoHaiLong);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMucDoHaiLong", new { id = mucDoHaiLong.Id }, mucDoHaiLong));
        }
Пример #2
0
        public async Task <IActionResult> PutMucDoHaiLong(int id, MucDoHaiLong mucDoHaiLong)
        {
            if (id != mucDoHaiLong.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }