public ActionResult CreateHashtag(Hashtag newHashtag) { var ops = OperationsFactory.CreateHashtagOps(); ops.CreateHashtag(newHashtag); return RedirectToAction("Index", "DraftPost"); }
public void CreateHashtag(Hashtag newHashtag) { using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { cn.Query<Hashtag>("insert into Hashtag(HashtagType) Values (@hashType)", new { hashType = newHashtag.HashtagType}); } }
public void CreateNewHashtagDbTest() { var repo = OperationsFactory.CreateHashtagOps(); var hashtag = new Hashtag() { HashtagType = "Trends", }; repo.CreateHashtag(hashtag); var list = repo.ListAllHashtags(); Assert.AreEqual(1,list.Count); }
public void CreateHashtag(Hashtag newHashtag) { if (!string.IsNullOrEmpty(newHashtag.HashtagType)) _repo.CreateHashtag(newHashtag); }