public ActionResult Update(RoundsLogModel RoundsLogObj) { //------------------------------------------ //Check ModelState //------------------------------------------ if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Invalid data")); } //------------------------------------------ try { bool result = RoundsLogFactor.Update(RoundsLogObj); 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)); } }
public ActionResult GetObject(int id) { try { RoundsLogModel RoundsLogObj = RoundsLogFactor.GetObject(id); if (RoundsLogObj == null) { RoundsLogObj = new RoundsLogModel(); } return(Json(RoundsLogObj, 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 { RoundsLogFactor.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 <RoundsLogModel> RoundsLogList = RoundsLogFactor.GetPageByPage(page, pageSize, sortname, sortorder, qtype, query, out totalRecords); if (RoundsLogList.Count > 0) { return(CreateFlexiJson(RoundsLogList, page, totalRecords)); } else { return(null); } } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }