public ActionResult Update(LanguagesModel LanguagesObj) { //------------------------------------------ //Check ModelState //------------------------------------------ if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Invalid data")); } //------------------------------------------ try { bool result = LanguagesFactor.Update(LanguagesObj); if (result == true) { return(List(1, 25, null, null, null, null)); } else { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Saving operation faild")); } } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }
//*********************************************************************************************** // // GET: /News/ public ActionResult Index() { FlexigridViewModel flexigrid = new FlexigridViewModel("NewsList", "NewsForm", "NewsPost", "/News/List", "json", "Title", "asc", true, "News Listing", true, pageSize, true, 950, 2000); flexigrid.Columns = new List <FlexigridColumn>() { new FlexigridColumn("LangID", "LangID", 86, true, "left", false, false), new FlexigridColumn("Type", "Type", 86, true, "left", false, false), new FlexigridColumn("Title", "Title", 86, true, "left", false, false), new FlexigridColumn("Details", "Details", 86, true, "left", false, false), new FlexigridColumn("PhotoFile", "PhotoFile", 86, true, "left", false, false), new FlexigridColumn("PhotoName", "PhotoName", 86, true, "left", false, false), new FlexigridColumn("AttachFile", "AttachFile", 86, true, "left", false, false), new FlexigridColumn("AttachName", "AttachName", 86, true, "left", false, false), new FlexigridColumn("EndDate", "EndDate", 86, true, "left", false, false), new FlexigridColumn("InsertDate", "InsertDate", 86, true, "left", false, false), new FlexigridColumn("LastModfiedDate", "LastModfiedDate", 86, true, "left", false, false) }; flexigrid.Buttons = new List <FlexigridButton>() { new FlexigridButton("Add", "fgButton", "Add"), new FlexigridButton("Edit", "fgButton", "Edit"), new FlexigridButton("Delete", "fgButton", "Delete") }; flexigrid.DialogBoxId = "NewsDialog"; flexigrid.DialogBoxWidth = 700; flexigrid.DialogBoxHeight = 800; ViewData["flexigrid"] = flexigrid; ViewData["LangID"] = LanguagesFactor.Get().Select(x => new SelectListItem { Text = x.Name, Value = x.LangID.ToString() }).ToList(); //ViewData["Categories"] = CategoriesFactor.Get().Select(x => new SelectListItem { Text = x.Title, Value = x.CategoryID.ToString() }).ToList(); return(View(new NewsModel())); }
public ActionResult GetObject(int id) { try { LanguagesModel LanguagesObj = LanguagesFactor.GetObject(id); if (LanguagesObj == null) { LanguagesObj = new LanguagesModel(); } return(Json(LanguagesObj, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }
//*********************************************************************************************** #endregion #region -----------------Delete----------------- //*********************************************************************************************** public ActionResult Delete(int[] ids) { //------------------------------------------ //Check ModelState //------------------------------------------ if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Invalid data")); } //------------------------------------------ try { LanguagesFactor.DeleteGroupofObjects(ids); return(List(1, 25, null, null, null, null)); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }
//*********************************************************************************************** #endregion #region -----------------List----------------- //*********************************************************************************************** public ActionResult List(int page, int rp, string sortname, string sortorder, string qtype, string query) { try { int pageSize = rp; int totalRecords = 0; List <LanguagesModel> LanguagesList = LanguagesFactor.GetPageByPage(page, pageSize, sortname, sortorder, qtype, query, out totalRecords); if (LanguagesList.Count > 0) { return(CreateFlexiJson(LanguagesList, page, totalRecords)); } else { return(null); } } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }