コード例 #1
0
        public async Task <bool> EditBookAsync(BookViewModel model)
        {
            try
            {
                _context.Update(_mapper.Map <Book>(model));
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception e) { }

            return(false);
        }
コード例 #2
0
        public async Task <bool> CancelReservation(Guid bookId)
        {
            var book = await GetBookByIdAsync(bookId);

            if (book == null)
            {
                return(false);
            }
            book.Status          = BookStatus.Free;
            book.Tenant          = null;
            book.TenantId        = null;
            book.ReservationTime = null;
            await _context.SaveChangesAsync();

            return(true);
        }