using Biggy; using HelpDoc.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using Biggy.Extensions; namespace HelpDoc.Data { public class HelpDb { static string DB_PATH = HttpContext.Current.Server.MapPath("~/files"); public BiggyList Posts = new BiggyList(DB_PATH); public BiggyList Tags = new BiggyList(DB_PATH); public BiggyList
Sections = new BiggyList
(DB_PATH); public BiggyList Users = new BiggyList(DB_PATH); public bool Create(Post post) { Posts.Add(post); Posts.Save(); return true; } public bool Update(Post post) { var find = Posts.First(p => p.Id == post.Id); Posts.Remove(find); Posts.Add(post); Posts.Save(); return true; } public void Delete(Post post) { Posts.Remove(post); Posts.Save(); } public List All () { var posts = Posts.TryLoadFileData(DB_PATH + "/posts.json"); return posts; } } }