public void SaveBlogAddNewTest() { ContentService contentService = new ContentService(); BlogDC serviceRequest = new BlogDC(); serviceRequest.BlogCategoryId = 1; serviceRequest.BlogTitle = "Blog Test for Approval"; serviceRequest.BlogDescription = "Blog Test for Approval Description"; serviceRequest.BlogContent = "Test Content"; contentService.SaveBlog(serviceRequest); }
public void SaveBlogUpdateTest() { ContentService contentService = new ContentService(); BlogDC serviceRequest = new BlogDC(); serviceRequest.BlogId = 8; serviceRequest.BlogCategoryId = 1; serviceRequest.BlogTitle = "Blog Test for Approval-Updated"; serviceRequest.BlogDescription = "Blog Test for Approval Description-Updated"; serviceRequest.BlogContent = "Test Content-Updated"; contentService.SaveBlog(serviceRequest); }
/// <summary> /// SaveBlog /// </summary> /// <param name="blog"></param> public void SaveBlog(BlogModel blog) { BlogDC blogDC = Mapper.Map <BlogModel, BlogDC>(blog); ServiceResponse <int> saveBlogResponse = _contentProxy.Execute(opt => opt.SaveBlog(blogDC)); if (saveBlogResponse.Status != ResponseStatus.Success) { HandleError(saveBlogResponse.Status, saveBlogResponse.ResponseMessage); } else { blog.BlogId = saveBlogResponse.Result; } }
/// <summary> /// SaveBlog /// </summary> /// <param name="blogRequest"></param> /// <returns></returns> public ServiceResponse <int> SaveBlog(BlogDC blog) { ServiceResponse <int> blogResponse = new ServiceResponse <int>(); try { SetContext(); Blog blogModel = Mapper.Map <BlogDC, Blog>(blog); _contentManager.SaveBlog(blogModel); blogResponse.Result = blogModel.BlogId; } catch (Exception ex) { HandleError(ex, blogResponse); } return(blogResponse); }