/// <summary> /// modify the title and body of the post /// </summary> /// <param name="owner"></param> /// <param name="post"></param> /// <param name="title"></param> /// <param name="body"></param> public static void ModiftyPost(Post post, string title, string body, Category category, Subcategory subcategory, Locale local, Area area) { using (var db = new ApplicationDbContext()) { Biz1.Modify(post, title, body, category, subcategory, local, area); db.SaveChanges(); } }
public void ModifyTest() { Post p = CreateRegularPost(); Assert.IsNotNull(p); Assert.AreEqual(p.Title, "Bubble Tea"); Biz1.Modify(p, "Naixue", p.Body, p.PostCategory, p.PostSubcategory, p.PostLocale, p.PostArea); Assert.AreEqual(p.Title, "Naixue"); Assert.AreEqual(p.Body, "Bubble Tea in longhua Jiufang"); Biz1.Modify(p, p.Title, "Red Mountain and Xili", p.PostCategory, p.PostSubcategory, p.PostLocale, p.PostArea); Assert.AreEqual(p.Body, "Red Mountain and Xili"); }