コード例 #1
0
 // GET: AboutUs
 public ActionResult GroupIntro()
 {
     var GroupIntros = db.GroupIntro.First();
  
         GroupIntroSummaryViewModel _GroupIntro = new GroupIntroSummaryViewModel
         {
             Title = GroupIntros.Title,
             Description = GroupIntros.Description
         };            
         return View(_GroupIntro);
 }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: nikkiLuan/Jiuding
        public ActionResult EditGroupIntroSubmit(string title, string content, int id, int echo)
        {

           var groupIntros = db.GroupIntro.Find(id);
            
                      
           groupIntros.Title = title;
           groupIntros.Description = content;
           //groupIntros.ID = id;                  

            
           db.SaveChanges();

           GroupIntroSummaryViewModel _GroupIntro = new GroupIntroSummaryViewModel()
           {
               ID = groupIntros.ID,
               Title = groupIntros.Title,
               Description = groupIntros.Description,
               ImagePath = null
           };

           var view_str = RazorViewToString.RenderRazorViewToString(this, "Partial/_GroupIntro", _GroupIntro);

           try
           {
               return new JsonResult()
               {
                   JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                   Data = new { result = "success", echo = echo, html = view_str }

               };
           }
           catch (Exception ex)
           {
               return new JsonResult()
               {
                   JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                   Data = new { result = "fail", message = ex.Message }
               };
           }

           //return RedirectToAction("GroupIntro");
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: nikkiLuan/Jiuding
        public ActionResult EditGroupIntro(string title, string content, int id, int echo)
        {
            try
            {
                GroupIntroSummaryViewModel _GroupIntro = new GroupIntroSummaryViewModel()
                {
                    ID = id,
                    Title = title,
                    Description = content,
                    ImagePath = null
                };

                //prepare the partial view by passing the model, turn the view into a string in order to render the html at the front end in js
                var view_str = RazorViewToString.RenderRazorViewToString(this, "Partial/_GroupIntroEdit", _GroupIntro);

                //return json result
                return new JsonResult()
                {
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                    Data = new { result = "success", echo = echo, html = view_str }
                    
                };
            }

            catch (Exception ex)
            {
                return new JsonResult()
                {
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                    Data = new { result = "fail", message = ex.Message }
                };
            }
        }
コード例 #4
0
ファイル: AdminController.cs プロジェクト: nikkiLuan/Jiuding
        public ActionResult GroupIntro()
        {
            var GroupIntros = db.GroupIntro.First();

            GroupIntroSummaryViewModel _GroupIntro = new GroupIntroSummaryViewModel()
            {
                ID = GroupIntros.ID,
                Title = GroupIntros.Title,
                Description = GroupIntros.Description,
                ImagePath = GroupIntros.ImageUrl
            };

            return View(_GroupIntro);
        }