コード例 #1
0
ファイル: BlogController.cs プロジェクト: nikoladoncev/test
 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());
 }
コード例 #2
0
ファイル: Blog.cs プロジェクト: nikoladoncev/test
 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;
 }
コード例 #3
0
ファイル: Blog.cs プロジェクト: nikoladoncev/test
 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;
 }
コード例 #4
0
ファイル: BlogController.cs プロジェクト: nikoladoncev/test
        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());
        }
コード例 #5
0
ファイル: BlogController.cs プロジェクト: nikoladoncev/test
 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());
 }