Beispiel #1
0
 /// <summary>
 /// ViewModel 转 DataModel
 /// </summary>
 /// <param name="userpositionVModel"></param>
 /// <returns></returns>
 public static UserPositionInfo UserPositionVModelToInfo(UserPositionVModel userpositionVModel)
 {
     if (userpositionVModel == null)
     {
         return(new UserPositionInfo());
     }
     return(new UserPositionInfo
     {
         UserId = userpositionVModel.UserId,
         Code = userpositionVModel.Code,
         Type = userpositionVModel.Type
     });
 }
Beispiel #2
0
 /// <summary>
 /// ViewModel 转 DataModel
 /// </summary>
 /// <param name="userposition"></param>
 /// <returns></returns>
 public static UserPositionInfo UserPositionVModelToInfo(UserPositionVModel userposition)
 {
     if (userposition == null)
     {
         return(new UserPositionInfo());
     }
     return(new UserPositionInfo
     {
         Id = userposition.Id,
         UserId = userposition.UserId,
         Code = userposition.Code,
         Type = userposition.Type,
         CreateTime = userposition.CreateTime
     });
 }
        public JsonResult Add(UserPositionVModel model)
        {
            var result = new JsonResultModel();

            if (ModelState.IsValid)
            {
                //add
                result.ResultState = UserPositions.AddUserPosition(UserPositions.UserPositionVModelToInfo(model)) > 0;
            }
            else
            {
                result.ResultState = false;
                result.Message     = ModelStateHelper.GetAllErrorMessage(ModelState);
            }

            return(Json(result));
        }
Beispiel #4
0
 /// <summary>
 /// 添加用户位置信息
 /// </summary>
 /// <param name="userPosition"></param>
 /// <returns></returns>
 public async Task <int> AddUserPosition(UserPositionVModel userPosition)
 {
     return(await Task.Run(() => UserPositions.AddUserPosition(UserPositions.UserPositionVModelToInfo(userPosition))));
 }
        public ActionResult Add()
        {
            var vm = new UserPositionVModel();

            return(View(vm));
        }