コード例 #1
0
        public async Task <IActionResult> AddBorrowBook(BorrowBookAddDto borrowBookAddDto)
        {
            var entity = _mapper.Map <BorrowBook>(borrowBookAddDto);
            await _repo.AddAsync(entity);

            return(Created("", entity));
        }
コード例 #2
0
        public async Task <IActionResult> UpdateEntity(BorrowBookAddDto borrowBookDto)
        {
            var entity = await _repo.GetByIdAsync(borrowBookDto.Id);

            if (entity == null)
            {
                return(NotFound("Borrow is not found"));
            }
            var updateBook = _mapper.Map <BorrowBook>(borrowBookDto);

            _repo.Update(updateBook);
            return(NoContent());
        }