コード例 #1
0
        public async Task <ActionResult <Room> > DeleteRoom(decimal id)
        {
            var room = _repository.GetByID(id);

            if (room == null)
            {
                return(NotFound(NotFoundEmptyJsonResult));
            }

            try
            {
                _repository.Delete(room);
                _repository.Save();
            }
            catch (DbUpdateException e)
            {
                return(StatusCode(500, InternalServerErrorJsonResult(e.Message)));
            }

            return(room);
        }
コード例 #2
0
        public IHttpActionResult DeleteOneRoom(int id)
        {
            _repository.Delete(id);

            return(Ok());
        }