public HomeController(ILogger <HomeController> logger, BlogBusinessRules blogBll, PostBusinessRules postBll, CommentBusinessRules commentBll) { _logger = logger; _blogBll = blogBll; _postBll = postBll; _commentBll = commentBll; }
/// <summary> /// The CreatePost /// </summary> /// <param name="post">The obj<see cref="Post"/></param> /// <param name="transaction">The transaction<see cref="TransactionalInformation"/></param> /// <returns>The <see cref="Post"/></returns> public Post CreatePost(Post post, out TransactionalInformation transaction) { transaction = new TransactionalInformation(); try { PostBusinessRules postBusinessRules = new PostBusinessRules(); ValidationResult results = postBusinessRules.Validate(post); bool validationSucceeded = results.IsValid; IList <ValidationFailure> failures = results.Errors; if (validationSucceeded == false) { transaction = ValidationErrors.PopulateValidationErrors(failures); return(post); } _dataService.CreateSession(); // Todo here: var param = post.ToDynamicParametersForInsert(); _dataService.PostRepository.Insert(PostScript.Insert, param, CommandType.Text); _dataService.CommitTransaction(true); transaction.ReturnStatus = true; transaction.ReturnMessage.Add("successfully."); } catch (Exception ex) { string errorMessage = ex.Message; transaction.ReturnMessage.Add(errorMessage); transaction.ReturnStatus = false; } finally { _dataService.CloseSession(); } return(post); }
public BlogAdministrationScreen(BlogBusinessRules blogBll, PostBusinessRules postBll, CommentBusinessRules commentsBll) { _blogBll = blogBll; _postBll = postBll; _commentsBll = commentsBll; }
public HomeController(BlogBusinessRules blogBll, PostBusinessRules postBll, CommentBusinessRules commentBll) { _blogBll = blogBll; _postBll = postBll; _commentBll = commentBll; }