Пример #1
0
        //[6][1] 입력
        public async Task <LibraryModel> AddAsync(LibraryModel model)
        {
            try
            {
                _context.Libraries.Add(model);
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                _logger.LogError($"ERROR({nameof(AddAsync)}): {e.Message}");
            }

            return(model);
        }
Пример #2
0
        //[6][4] 수정
        public async Task <bool> EditAsync(LibraryModel model)
        {
            try
            {
                _context.Libraries.Attach(model);
                _context.Entry(model).State = EntityState.Modified;
                return(await _context.SaveChangesAsync() > 0 ? true : false);
            }
            catch (Exception e)
            {
                _logger.LogError($"ERROR({nameof(EditAsync)}): {e.Message}");
            }

            return(false);
        }