コード例 #1
0
        public async Task <IActionResult> Add(Param_Person param)
        {
            Person person = new Person()
            {
                Name = param.Name,
                Age  = param.Age
            };
            var flag = await _personService.AddPersonAsync(person);

            if (flag)
            {
                Result.status  = true;
                Result.message = "新增成功";
                return(Json(Result));
            }
            else
            {
                return(Json(Result));
            }
        }
コード例 #2
0
        public async Task <IActionResult> Update(Param_Person param)
        {
            Person person = new Person()
            {
                Id   = param.Id,
                Name = param.Name,
                Age  = param.Age
            };
            var flag = await _personService.ModifyPersonAsync(person);

            if (flag)
            {
                Result.status  = true;
                Result.message = "修改成功";
                return(Json(Result));
            }
            else
            {
                return(Json(Result));
            }
        }