Example #1
0
        public IActionResult GetMerchantAgents(string MerchantId)
        {
            try
            {
                List <UserRegistration> userlist = new List <UserRegistration>();
                using (IUserProcessor _userProcessor = new UserProcessor(_applicationDbContext))
                {
                    userlist = _userProcessor.GetMerchantAgent(MerchantId);
                }

                if (userlist.Count() > 0)
                {
                    return(Ok(new Application_ResponseWrapper()
                    {
                        ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = userlist.ToList <UserRegistration>()
                    }));
                }
                else
                {
                    return(Ok(new Application_ResponseWrapper()
                    {
                        ResponseCode = "1004", ResponseMessage = "Record not found", Status = "failed"
                    }));
                }
            }
            catch (Exception ex)
            {
                _errorRepository.
                Add(new Application_Errors
                {
                    applicationID    = 1,
                    errorDescription = ex.ToString(),
                    errorType        = "Exception",
                    logDate          = System.DateTime.Now,
                    pageID           = 0,
                    Source           = "Mpower/Rail/UserRegistration/GetMerchantAgents"
                });
                _errorRepository.Commit();
                return(Ok(new Application_ResponseWrapper()
                {
                    ResponseCode = "1005", ResponseMessage = "An error has occured", Status = "failed"
                }));
            }
        }