コード例 #1
0
        public async Task <IActionResult> Edit(ModuleModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(ResultDto.Err((GetErrorFromModelStateStr()))));
            }

            var m = await ModuleApp.GetAsync(model.Id);

            if (m == null)
            {
                return(Json(ResultDto.Err(("数据不存在或已被删除"))));
            }

            m = model.MapToMeg <ModuleModel, Module>(m);
            var r = await ModuleApp.UpdateAsync(m);

            return(Json(r));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(ModuleModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Operation(false, GetErrorFromModelStateStr()));
            }

            Module m = await ModuleApp.GetAsync(model.Id);

            if (m == null)
            {
                return(Operation(false, "数据不存在或已被删除"));
            }

            m = MapperHelper.Map <ModuleModel, Module>(model, m);
            var r = await ModuleApp.UpdateAsync(m);

            return(Operation(r.IsSuc, r.Msg));
        }