예제 #1
0
        public void CreateMenu(SaveMenuDto saveMenuDto)
        {
            var menu = _mapper.Map <SaveMenuDto, Menu>(saveMenuDto);

            _unitOfWork.Menus.Add(menu);

            _unitOfWork.Complete();
        }
예제 #2
0
        public void UpdateMenu(SaveMenuDto saveMenuDto)
        {
            var menu = _unitOfWork.Menus.GetBy(saveMenuDto.MenuId);

            if (menu == null)
            {
                return;
            }

            _mapper.Map <SaveMenuDto, Menu>(saveMenuDto, menu);

            _unitOfWork.Complete();
        }
예제 #3
0
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var menu = _service.GetMenu(id ?? default(int));

            if (menu == null)
            {
                return(NotFound());
            }

            Menu = _mapper.Map <MenuDto, SaveMenuDto>(menu);

            return(Page());
        }