Пример #1
0
 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)); }
 }
Пример #2
0
 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));
     }
 }
Пример #3
0
        //***********************************************************************************************
        #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)); }
        }
Пример #4
0
        //***********************************************************************************************
        #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));
            }
        }