public async Task <bool> AddMenu(MenuEditVO vo, Guid createdUserId, string createdUserName) { var now = DateTime.UtcNow; var entity = new Menu { Guid = Guid.NewGuid(), Name = vo.Name, Url = vo.Url, Icon = vo.Icon, ParentGuid = vo.ParentId, ParentName = vo.ParentName, Sort = vo.Sort, Status = Status.Normal, IsDeleted = IsDeleted.No, CreateTime = now, CreateUserGuid = createdUserId, CreateUserLoginName = createdUserName, LastModifyTime = now, LastModifyUserGuid = createdUserId, LastModifyUserLoginName = createdUserName, HideMenu = YesOrNo.No, }; var result = await _menuRepository.AddAsync(entity); return(result != null); }
public async Task <IActionResult> Add(MenuEditVO vo) { var currentUserId = User.FindFirstValue(ClaimTypes.NameIdentifier); var currentUserName = User.FindFirstValue(ClaimTypes.Name); var result = await _menuService.AddMenu(vo, new Guid(currentUserId), currentUserName); return(Json(new BizServiceResponse(BizServiceResponseCode.Success, "新建成功"))); }