public OperationResult AddFuncToGroup(long funcId, long usrGroupId, FuncAccessType accessType) { try { var dbContext = new AlohaDb(); var result = dbContext.UserGroupAccesses.FirstOrDefault(uga => uga.UserFuncId == funcId && uga.UserGroupId == usrGroupId); if (result != null) { return(new OperationResult { Success = false, ErrorMessage = "Func already presemted in this group" }); } var newLink = dbContext.UserGroupAccesses.Add( new Entities.UserGroupAccess { AccessId = (int)accessType, UserFuncId = funcId, UserGroupId = usrGroupId }); dbContext.SaveChanges(); return(new OperationResult { Success = true, CreatedObjectId = newLink.Id }); } catch (Exception e) { log.Error("Error", e); return(new OperationResult { Success = false, ErrorMessage = e.Message }); } }
public OperationResult AddFuncToGroup(long funcId, long usrGroupId, FuncAccessType accessType) { return(userGroupService.AddFuncToGroup(funcId, usrGroupId, accessType)); }