public static void CreateBlog(string user, long styleId, long themeId, string name, string desc) { long uid = DataAccess.UserCRUD.GetUserByLogin(user).Id; DataAccess.T_Blog blog = new DataAccess.T_Blog() { UserId = uid, CreationDate = DateTime.Now, Description = desc, Name = name, StyleId = styleId, ThemeId = themeId }; DataAccess.BlogCRUD.Create(blog); }
public static void Create(T_Blog blog) { try { using (Entities bdd = new Entities()) { bdd.T_Blog.Add(blog); bdd.SaveChanges(); } } catch (Exception e) { Trace.WriteLine(e.Message); throw; } }
public static void Update(long blogId, T_Blog blg) { try { using (Entities bdd = new Entities()) { T_Blog blog = Get(blogId); blog = blg; bdd.SaveChanges(); } } catch (Exception e) { Trace.WriteLine(e.Message); throw; } }
public static List <T_Article> GetBlogContent(string userName, string blogName) { using (Entities bdd = new Entities()) { try { T_User user = bdd.T_User.Where(usr => usr.Login == userName).FirstOrDefault(); T_Blog blog = bdd.T_Blog.Include("T_Article").Where(blg => blg.Name == blogName && blg.UserId == user.Id).FirstOrDefault(); return(new List <T_Article>(blog.T_Article)); } catch (Exception e) { Trace.WriteLine(e.Message); throw; } } }
public Blog() { blog = null; }
public Blog(string username, string blogname) { blog = DataAccess.BlogCRUD.Get(username, blogname); }
public Blog(long id) { blog = DataAccess.BlogCRUD.Get(id); }