public async Task <ApiRequestResult> AddAsync(MenuDto dto) { var menu = dto.EntityMap <MenuDto, Menu>(); await _menuRepository.AddAsync(menu); return(ApiRequestResult.Success("添加成功")); }
public async Task <ApiRequestResult> UpdateAsync(MenuDto dto) { try { var entity = await _menuRepository.GetAsync(dto.Id.Value); var newEntity = dto.EntityMap(entity); await _menuRepository.UpdateAsync(newEntity); } catch (Exception ex) { throw; } return(ApiRequestResult.Success("修改成功")); }