public bool EditPost(Post post, string key) { using (var transaction = new TransactionScope()) { var postExist = this.GetPostByKey(key); if (postExist == null) { return(false); } post.Post_id = Int32.Parse(key); var dateTimeNow = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); post.Updated_at_date_time = DateTime.Parse(dateTimeNow); CheckIfFieldIsEmpty.CheckPostField(postExist, post); this._postRepository.EditPost(post); transaction.Complete(); return(true); } }
public bool EditPage(Page page, string key) { using (var transaction = new TransactionScope()) { var pageExist = this.GetPageByKey(key).First(); if (pageExist == null) { return(false); } page.Page_id = Int32.Parse(key); var dateTimeNow = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); page.Updated_at_date_time = DateTime.Parse(dateTimeNow); CheckIfFieldIsEmpty.CheckPageField(pageExist, page); this._pageRepository.EditPage(page); transaction.Complete(); return(true); } }