コード例 #1
0
        public async Task <IActionResult> Create(LocationViewModel vm)
        {
            var result = await _locationServices.Create(vm, GetAccount());

            if (result.Status == Status.ok)
            {
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                ModelState.AddModelError("", "保存失败: " + result.Message);
                await Init(vm);

                return(View(vm));
            }
        }