Ejemplo n.º 1
0
        public async Task <IActionResult> PutBacLuong([FromRoute] int id, [FromBody] BacLuong bacluong)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != bacluong.BacLuongId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostBacLuong([FromBody] BacLuong bacluong)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.BacLuongs.Add(bacluong);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBacLuong", new { id = bacluong.BacLuongId }, bacluong));
        }