예제 #1
0
        // 입력
        public async Task <BoardUploads> AddAsync(BoardUploads model)
        {
            _context.BoardUploads.Add(model);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                _logger.LogError($"에러 발생({nameof(AddAsync)}): {e.Message}");
            }
            return(model);
        }
예제 #2
0
        // 수정
        public async Task <bool> EditAsync(BoardUploads model)
        {
            _context.BoardUploads.Attach(model);
            _context.Entry(model).State = EntityState.Modified;

            try
            {
                return(await _context.SaveChangesAsync() > 0 ? true : false);
            }
            catch (Exception e)
            {
                _logger.LogError($"에러발생({nameof(EditAsync)}): {e.Message}");
            }
            return(false);
        }