예제 #1
0
        public void DeleteMemo(Memo memo)
        {
            memo = MemoDao.GetMemoByKeynote(memo.Keynote);

            if (memo != null)
            {
                MemoDao.DeleteMemo(memo);
            }
        }
예제 #2
0
 public void DeleteEmployee(Memo memo)
 {
     try
     {
         MemoService.DeleteMemo(memo);
     }
     catch (Exception)
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
예제 #3
0
        public Memo AddMemo(Memo memo)
        {
            CheckMemoIsNotNullThrowException(memo);

            try
            {
                return MemoService.AddMemo(memo);
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
예제 #4
0
        public Memo UpdateMemo(Memo memo)
        {
            CheckmemoIsNullThrowException(memo);

            try
            {
                MemoService.UpdateMemo(memo);
                return MemoService.GetMemoByKeynote(memo.Keynote);
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
예제 #5
0
 public void UpdateMemo(Memo memo)
 {
     MemoDao.UpdateMemo(memo);
 }
예제 #6
0
 public Memo AddMemo(Memo memo)
 {
     MemoDao.AddMemo(memo);
     return GetMemoByKeynote(memo.Keynote);
 }
예제 #7
0
        /// <summary>
        ///     檢查課程資料是否存在,如果不存在則拋出錯誤.
        /// </summary>
        /// <param name="memo">
        ///     課程資料.
        /// </param>
        private void CheckmemoIsNullThrowException(Memo memo)
        {
            Memo dbMemo = MemoService.GetMemoById(memo.Id);

            if (dbMemo == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
        }
예제 #8
0
        /// <summary>
        ///     檢查課程資料是否存在,如果存在則拋出錯誤.
        /// </summary>
        /// <param keynote="memo">
        ///     課程資料.
        /// </param>
        private void CheckMemoIsNotNullThrowException(Memo memo)
        {
            Memo dbMemo = MemoService.GetMemoById(memo.Id);

            if (dbMemo != null)
            {
                throw new HttpResponseException(HttpStatusCode.Conflict);
            }
        }