public async Task <IActionResult> TechNoteView(int id)
        {
            if (id == 0)
            {
                return(View());
            }
            else
            {
                var techNote = await _techNoteService.GetTechNoteById(id);

                if (techNote == null)
                {
                    string referer = Request.Headers["Referer"].ToString();
                    TempData["ErrorMsg"] = "자료가 존재하지 않습니다.";
                    return(Redirect(referer));
                }
                techNote.m_read++;
                await _techNoteService.UpdateTechNote(techNote, true);


                var nextPrev = _dbRecordService.GetPrevNext("TechNotes", id);
                ViewBag.NextPrev = nextPrev;

                return(View(techNote));
            }
        }
Exemple #2
0
        public async Task <IActionResult> NoticeView(int id)
        {
            try
            {
                var notice = await _noticeService.GetNoticeById(id);

                var nextPrev = _dbRecordService.GetPrevNext("notice", id);
                ViewBag.NextPrev = nextPrev;

                return(View(notice));
            }
            catch (Exception ex)
            {
                if (ex.Message == "NOT-FOUND")
                {
                    TempData["ErrorMsg"] = "자료가 존재하지 않습니다.";
                    return(Redirect(Request.Headers["Referer"].ToString()));
                }
                else
                {
                    throw ex;
                }
            }
        }