Esempio n. 1
0
 public ActionResult EditingAddNewPartial([ModelBinder(typeof(DevExpress.Web.Mvc.DevExpressEditorsBinder))] Model.BlogGrupa BlogGrupa)
 {
     Model.BazaEntities  db = new Model.BazaEntities ();
     try
     {
         Model.BlogGrupa newBlogGrupa = new Model.BlogGrupa();
         newBlogGrupa.BlogGrupaNaziv = BlogGrupa.BlogGrupaNaziv;
         db.AddToBlogGrupas(newBlogGrupa);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         ViewData["EditError"] = e.Message;
     }
     return PartialView("BlogPartial", (from r in db.BlogGrupas select r).ToList());
 }
Esempio n. 2
0
 public static String EditBLog(string _BlogNaslov, string _BlogSodrzina, int _blogGtupaID,int _blogID)
 {
     string _ret = "0";
     Model.BazaEntities db = new Model.BazaEntities();
     try
     {
         Model.Blog editBlog = db.Blogs.First(i => i.BlogID == _blogID);
         editBlog.BlogNaslov = _BlogNaslov;
         editBlog.BlogSodrzina = _BlogSodrzina;
         editBlog.BlogGrupaID = _blogGtupaID;
         editBlog.BlogVreme = DateTime.Now;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         _ret = e.Message;
     }
     return _ret;
 }
Esempio n. 3
0
        public ActionResult EditingDeletePartial(int BlogGrupaID)
        {
            Model.BazaEntities  db = new Model.BazaEntities ();
            if (BlogGrupaID >= 0)
            {
                try
                {

                    Model.BlogGrupa deleteBlogGrupa = db.BlogGrupas.First(i => i.BlogGrupaID == BlogGrupaID);
                    if (deleteBlogGrupa != null)
                        db.BlogGrupas.DeleteObject(deleteBlogGrupa);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            return PartialView("BlogPartial", (from r in db.BlogGrupas select r).ToList());
        }
Esempio n. 4
0
 public static IEnumerable GetBlogGrupas()
 {
     Model.BazaEntities db = new Model.BazaEntities();
     return (from r in db.BlogGrupas select r).ToList();
 }
Esempio n. 5
0
 public static String InsertBLog(string _BlogNaslov, string _BlogSodrzina, int _blogGtupaID)
 {
     string _ret="0";
     MembershipUser myObject = Membership.GetUser();
     Guid UserID = (Guid)myObject.ProviderUserKey;
     Model.BazaEntities db = new Model.BazaEntities();
     try
     {
         Model.Blog newBlog = new Model.Blog();
         newBlog.BlogNaslov = _BlogNaslov;
         newBlog.BlogSodrzina = _BlogSodrzina;
         newBlog.BlogGrupaID = _blogGtupaID;
         newBlog.BlogBrojGlasovi = 0;
         newBlog.BlogBrojKomentar  = 0;
         newBlog.BlogBrojPregledi = 0;
         newBlog.BlogVreme  = DateTime.Now;
         newBlog.UserID  = UserID;
         db.AddToBlogs(newBlog);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         _ret = e.Message;
     }
     return _ret;
 }
Esempio n. 6
0
 public static IEnumerable GetMyBlogs()
 {
     Model.BazaEntities db = new Model.BazaEntities();
     MembershipUser myObject = Membership.GetUser();
     Guid UserID =  (Guid)myObject.ProviderUserKey;
     return (from r in db.Blogs
             join au in db.aspnet_Users on r.UserID equals au.UserId
             join Kategorija in db.BlogGrupas on r.BlogGrupaID equals Kategorija.BlogGrupaID
             where r.UserID == UserID
             orderby r.BlogVreme descending
             select new BlogView
             {
                 BlogID = r.BlogID,
                 BlogNaslov = r.BlogNaslov,
                 BlogSodrzina = r.BlogSodrzina,
                 BlogVreme = r.BlogVreme,
                 UserID = r.UserID,
                 BlogBrojKomentar = r.BlogBrojKomentar,
                 BlogBrojGlasovi = r.BlogBrojGlasovi,
                 BlogBrojPregledi = r.BlogBrojPregledi,
                 BlogGrupaID = r.BlogGrupaID,
                 UserName = au.UserName,
                 BlogGrupaNaziv = Kategorija.BlogGrupaNaziv
             }).ToList();
 }
Esempio n. 7
0
 public static IEnumerable GetBlogs()
 {
     Model.BazaEntities  db = new Model.BazaEntities();
     return (from r in db.Blogs
             join au in db.aspnet_Users on r.UserID equals au.UserId
             join Kategorija in db.BlogGrupas on r.BlogGrupaID equals Kategorija.BlogGrupaID
             orderby r.BlogVreme descending
             select new BlogView
             {
                 BlogID = r.BlogID,
                 BlogNaslov = r.BlogNaslov,
                 BlogSodrzina = r.BlogSodrzina,
                 BlogVreme = r.BlogVreme,
                 UserID = r.UserID,
                 BlogBrojKomentar = r.BlogBrojKomentar,
                 BlogBrojGlasovi =r .BlogBrojGlasovi,
                 BlogBrojPregledi = r.BlogBrojPregledi,
                 BlogGrupaID = r.BlogGrupaID ,
                 UserName = au.UserName,
                 BlogGrupaNaziv = Kategorija.BlogGrupaNaziv
                 }).ToList();
 }
Esempio n. 8
0
 public ActionResult BlogPartial()
 {
     Model.BazaEntities  db = new Model.BazaEntities ();
     return PartialView((from r in db.BlogGrupas select r).ToList());
 }
Esempio n. 9
0
 public ActionResult MyBlogs()
 {
     if (Session["MyBlogPages"] == null)
         Session["MyBlogPages"] = 0;
     int RedBr = Convert.ToInt32(Session["MyBlogPages"].ToString());
     Model.BazaEntities db = new Model.BazaEntities();
     return View((from r in db.BlogGrupas select r).OrderBy(r => r.BlogGrupaNaziv).Skip(RedBr).Take(20).ToList());
 }
Esempio n. 10
0
 public ActionResult EditingUpdatePartial([ModelBinder(typeof(DevExpress.Web.Mvc.DevExpressEditorsBinder))] Model.BlogGrupa BlogGrupa)
 {
     Model.BazaEntities  db = new Model.BazaEntities ();
     try
     {
         Model.BlogGrupa editBlogGrupa = db.BlogGrupas.First(i => i.BlogGrupaID == BlogGrupa.BlogGrupaID);
         editBlogGrupa.BlogGrupaNaziv = BlogGrupa.BlogGrupaNaziv;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         ViewData["EditError"] = e.Message;
     }
     return PartialView("BlogPartial", (from r in db.BlogGrupas select r).ToList());
 }