// GET: AboutUs public ActionResult GroupIntro() { var GroupIntros = db.GroupIntro.First(); GroupIntroSummaryViewModel _GroupIntro = new GroupIntroSummaryViewModel { Title = GroupIntros.Title, Description = GroupIntros.Description }; return View(_GroupIntro); }
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"); }
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 } }; } }
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); }