public void AddPost(Post post) { try { // check post code is already exist var b = _context.Post.Where(item => item.CodePost == post.CodePost).SingleOrDefault(); if (b == null) { _postDAL.AddPost(post); } else { throw new Exception("Mã bài viết đã tồn tại"); } } catch (Exception ex) { if (ex.Message.Contains("Mã bài viết đã tồn tại")) { throw new Exception(ex.Message.ToString()); } else { throw new Exception("Error from PostBLL: " + ex.Message.ToString()); } } }
/// <summary> /// 新增岗位信息 /// </summary> /// <param name="post">新增的工作岗位信息</param> /// <returns></returns> public void AddPost(Post post) { objLogBll.WriteLog("新增岗位“" + post.PostName + "”基本信息"); dal.AddPost(post); }