コード例 #1
0
        public IActionResult Edit(RoomViewModel roomViewModel)
        {
            var roomDomain = mapper.Map <Room>(roomViewModel);

            roomApp.Update(roomDomain);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Edit(RoomViewModel roomViewModel)
        {
            if (ModelState.IsValid)
            {
                var roomRet = _roomAppService.Update(roomViewModel);
                if (roomRet.ValidationResult.IsValid)
                {
                    return(RedirectToAction("Index"));
                }

                AddErrorIntoModelState(roomRet.ValidationResult);
            }
            return(View(roomViewModel));
        }
コード例 #3
0
        public async Task <IActionResult> OnPostAsync(int id)
        {
            Id           = id;
            ErrorMessage = "";
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = await _roomAppService.Update(id, Room);

            if (!result.IsSuccess)
            {
                ErrorMessage = result.Message;
                return(Page());
            }
            else
            {
                return(RedirectToPage("/Map/Index"));
            }
        }