Exemple #1
0
        public async Task <MISMappingRes> CheckMisMappingsRoles([FromBody] AgentCompanyReq request)
        {
            var response = new MISMappingRes();

            try
            {
                if (request != null)
                {
                    response = await _MISRepository.CheckMisMappingsRoles(request);

                    if (response == null)
                    {
                        response.ResponseStatus.Status       = "Failure";
                        response.ResponseStatus.ErrorMessage = "An error.";
                    }
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "Request details can not be blank.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message.ToString();
            }
            return(response);
        }
Exemple #2
0
        public async Task <MISMappingRes> CheckMisMappingsRoles(AgentCompanyReq request)
        {
            MISMappingRes response = new MISMappingRes();

            try
            {
                #region MIS Mapping List
                if (request?.Roles?.Count() <= 0 && !string.IsNullOrEmpty(request?.UserId))
                {
                    request.Roles = _MongoContext.mUsersInRoles.AsQueryable().Where(a => a.UserId == request.UserId).Select(a => a.RoleName).ToArray();
                }

                if (request?.Roles?.Count() > 0)
                {
                    response.MISMappingList = _MongoContext.mMISMapping.AsQueryable().Where(a => a.UserGroups.Any(b => request.Roles.Contains(b)))
                                              .Select(a => new MISMappingDetails {
                        ItemName = a.Item, ItemUrl = a.ItemUrl, ItemSeq = a.ItemSeq
                    }).ToList();
                }
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(response);
        }
Exemple #3
0
        public async Task <MISMappingRes> CheckMisMappingsRoles(AgentCompanyReq request, string ticket)
        {
            MISMappingRes misMappingRes = new MISMappingRes();

            misMappingRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceMIS:CheckMisMappingsRoles"), request, typeof(MISMappingRes), ticket);

            return(misMappingRes);
        }