public async Task PostBlog(Blog blog, DateTime tsStamp, string usStamp, string asStamp) { PostLogic postLogic = new PostLogic(_context); blog.SetBaseData(tsStamp, usStamp, asStamp); _context.Entry(blog).State = EntityState.Added; await _context.SaveChangesAsync(); await postLogic.PostPosts(blog.Posts, tsStamp, usStamp, asStamp); }
public async Task <Blog> DeleteBlog(int id) { var blog = await _context.Blog.FindAsync(id); _context.Blog.Remove(blog); await _context.SaveChangesAsync(); PostLogic postLogic = new PostLogic(_context); await postLogic.Delete(id); return(blog); }
public async Task PutBlog(Blog blog, DateTime tsStamp, string usStamp, string asStamp) { PostLogic postLogic = new PostLogic(_context); blog.SetBaseData(tsStamp, usStamp, asStamp); _context.Entry(blog).State = EntityState.Modified; try { await _context.SaveChangesAsync(); await postLogic.PutPosts(blog.Posts, tsStamp, usStamp, asStamp); } catch (DbUpdateConcurrencyException) { throw; } }