コード例 #1
0
        public HttpResponseMessage Post([FromBody] CoordinatesModel parameter)
        {
            try
            {
                GxRjxxBusiness gxRjxxBusiness = new GxRjxxBusiness();
                var            entity         = gxRjxxBusiness.Find(parameter.Id);
                if (entity == null)
                {
                    var loginResult = new DataResult <string>();
                    loginResult.ErrorCode = "404";
                    loginResult.Result    = false;
                    loginResult.Message   = "未找到人井信息";
                    return(Request.CreateResponse(HttpStatusCode.OK, loginResult));
                }
                entity.LONGITUDE  = parameter.Longitude;
                entity.LATITUDE   = parameter.Latitude;
                entity.MODIFYBY   = "接口数修改";
                entity.MODIFYTIME = DateTime.Now;
                gxRjxxBusiness.Update(entity);

                var dataResult = new DataResult <string>();
                if (gxRjxxBusiness.SaveChange() > 0)
                {
                    dataResult.ErrorCode = "200";
                    dataResult.Result    = true;
                    dataResult.Message   = "人井坐标信息修改成功";
                    dataResult.Data      = "";
                    return(Request.CreateResponse(HttpStatusCode.OK, dataResult));
                }
                else
                {
                    dataResult.ErrorCode = "500";
                    dataResult.Result    = false;
                    dataResult.Message   = "人井坐标信息修改失败";
                    dataResult.Data      = "";
                    return(Request.CreateResponse(HttpStatusCode.OK, dataResult));
                }
            }
            catch (Exception ex)
            {
                DataResult <string> dataResult = new DataResult <string>();
                dataResult.ErrorCode = "100101";
                dataResult.Result    = false;
                dataResult.Message   = "获取数据异常:" + (ex.InnerException == null ? ex.Message : ex.InnerException.Message);
                return(Request.CreateResponse(HttpStatusCode.OK, dataResult));
            }
        }
コード例 #2
0
        public ActionResult Edit(FormCollection form, GX_RJXX gxrjxx)
        {
            decimal id    = ConvertUtility.ToDecimal(form["Id"]);
            var     model = gxXlzxBusiness.Find(id);

            if (model == null)
            {
                return(Json(AjaxResult.Error("未找到需要更新的数据!")));
            }
            gxrjxx            = model;
            gxrjxx.RJMC       = form["RJMC"];
            gxrjxx.GCRJBH     = form["GCRJBH"];
            gxrjxx.JGSL       = ConvertUtility.ToInt(form["JGSL"]);
            gxrjxx.DXLX       = form["DXLX"];
            gxrjxx.RSJCC      = form["RSJCC"];
            gxrjxx.DXLX       = form["DXLX"];
            gxrjxx.LONGITUDE  = form["LONGITUDE"];
            gxrjxx.LATITUDE   = form["LATITUDE"];
            gxrjxx.MODIFYBY   = CurrentUser.UserName;
            gxrjxx.MODIFYTIME = DateTime.Now;
            gxXlzxBusiness.Update(gxrjxx);
            return(Json(gxXlzxBusiness.SaveChange() > 0 ? AjaxResult.Success("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
        }