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

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

            try
            {
                return MemoService.AddMemo(memo);
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
        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);
 }
        /// <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);
            }
        }
        /// <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);
            }
        }