public static MvcHtmlString CategoryLink(this HtmlHelper helper, Category category)
 {
     if (category != null)
     {
         return helper.ActionLink(category.Name, "Category", "Blog", new {category = category.CatUrlSlug},
             new {title = String.Format("See all posts in {0}", category.Name)});
     }
     return null;
 }
Exemple #2
0
 /// <summary>
 /// 更新数据行
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>更新成功则返回true</returns>
 public bool Update(Category entity)
 {
    return CONN.Update<Category>(entity);            
 }
Exemple #3
0
 /// <summary>
 /// 从数据库中删除指定的实体,是以主键方式删除
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>删除成功则返回true</returns>
 public bool Delete(Category entity)
 {         
    return CONN.Delete<Category>(entity);
 }
Exemple #4
0
 /// <summary>
 /// 在数据库中添加行,如果主键是自增的那么设置主键是没有意义的
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns></returns>
 public bool Add(Category entity)
 {
     return CONN.Insert<Category>(entity);            
 }
 /// <summary>
 /// 更新数据行
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>更新成功则返回true</returns>
 public bool Update(Category entity)
 {
    return CategoryDAL.Instance.Update(entity);
 }
 /// <summary>
 /// 从数据库中删除指定的实体,是以主键方式删除
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>删除成功则返回true</returns>
 public bool Delete(Category entity)
 {
    return CategoryDAL.Instance.Delete(entity);
 }
 public bool Add(Category entity)
 {
     return CategoryDAL.Instance.Add(entity);
 }