예제 #1
0
        public async Task <ActionResult <ConsultingRoom> > PostConsultingRoom(ConsultingRoom consultingRoom)
        {
            _context.ConsultingRoom.Add(consultingRoom);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetConsultingRoom", new { id = consultingRoom.ID }, consultingRoom));
        }
예제 #2
0
        public async Task <IActionResult> PutConsultingRoom(string id, ConsultingRoom consultingRoom)
        {
            if (id != consultingRoom.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }