Пример #1
0
        private UserDetailResponseDTO FillUserDetail(PayLendUser resultDto)
        {
            UserDetailResponseDTO userDetail = new UserDetailResponseDTO();

            try
            {
                userDetail.simpleReturnDTO = new SimpleReturnDTO();
                if (resultDto != null)
                {
                    userDetail.payLendUser         = resultDto;
                    userDetail.payLendUser.Country = _countryManager.GetAll().FirstOrDefault(x => x.ID == resultDto.CountryId);
                    userDetail.payLendUser.Banks   = _repository.GetAll <PayLend.Core.Entities.BankUser>(includeProperties: "Bank").Where(x => x.PayLendUser.Id == resultDto.Id).ToList();

                    var memberInfo = resultDto.GetType().BaseType;
                    if (memberInfo != null && memberInfo.Name == DiscriminatorEnum.Borrower.ToString())
                    {
                        userDetail.payLendUser.DiscriminatorType = DiscriminatorEnum.Borrower;
                        //Legal Representative tem que passar a ser os dados da empresa
                        if (userDetail.payLendUser.RegisterType == RegisterTypeEnum.EmpresaCompleto)
                        {
                            //userDetail.legalRepresentative = Repository.GetAll<LegalRepresentative>(x => x.PayLendUserId == resultDTO.Id).FirstOrDefault();
                        }
                    }
                    else if (resultDto.GetType().BaseType.Name == DiscriminatorEnum.Lender.ToString())
                    {
                        userDetail.payLendUser.DiscriminatorType = DiscriminatorEnum.Lender;
                    }
                    else if (resultDto.GetType().BaseType.Name == DiscriminatorEnum.Admin.ToString())
                    {
                        userDetail.payLendUser.DiscriminatorType = DiscriminatorEnum.Admin;
                    }
                    else
                    {
                        userDetail.payLendUser.DiscriminatorType = DiscriminatorEnum.Todos;
                    }

                    userDetail.payLendUser.PayLendCard.FirstOrDefault().Balance         = userDetail.payLendUser.PayLendCard.FirstOrDefault().Balance;
                    userDetail.payLendUser.PayLendCard.FirstOrDefault().PendingBalance  = userDetail.payLendUser.PayLendCard.FirstOrDefault().PendingBalance;
                    userDetail.payLendUser.PayLendCard.FirstOrDefault().AvaiableBalance = userDetail.payLendUser.PayLendCard.FirstOrDefault().AvaiableBalance;
                }
                else
                {
                    userDetail.simpleReturnDTO.ErrorMessage = "HaveUserID_DontHaveData";
                    userDetail.simpleReturnDTO.ErrorType    = ErrorType.Form;
                    userDetail.simpleReturnDTO.ErrorKey     = "UserDetails";
                }
            }
            catch (Exception e)
            {
                userDetail.simpleReturnDTO.ErrorMessage = e.Message;
                userDetail.simpleReturnDTO.ErrorType    = ErrorType.Form;
                userDetail.simpleReturnDTO.ErrorKey     = "UserDetails";
                return(userDetail);
            }
            return(userDetail);
        }
        private List <SelectListItem> CountryList()
        {
            List <SelectListItem> countryList = _iCountryManager.GetAll()
                                                .Select(c => new SelectListItem
            {
                Value = c.Id.ToString(),
                Text  = c.Name,
            }).ToList();

            return(countryList);
        }
 public IActionResult Index()
 {
     if (HttpContext.Session.GetString("AdminId") != null)
     {
         return(View(_iCountryManager.GetAll()));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
        public void Country_Get_All()
        {
            //Arrange
            _mockRepository.Setup(x => x.GetAll()).Returns(listCountry);

            //Act
            List <Country> results = _service.GetAll() as List <Country>;

            //Assert
            Assert.IsNotNull(results);
            Assert.AreEqual(3, results.Count);
        }
 //GET
 public ActionResult Create()
 {
     ViewBag.Countries = new SelectList(_countryManager.GetAll().ToList(), "Id", "Name");
     return(View());
 }
Пример #6
0
 //
 // GET: /Country/
 public ActionResult Index()
 {
     return(View(_Country.GetAll()));
 }
Пример #7
0
        public async Task <ViewResult> ShowCountry()
        {
            var entity = await _manager.GetAll();

            return(View(entity));
        }
 // GET: /Person/Create
 public ActionResult Create()
 {
     ViewBag.CountryId = new SelectList(_Country.GetAll(), "Id", "Name");
     return(View());
 }
Пример #9
0
 // GET: Validation
 public JsonResult CheckCountryNameForExist(CountryViewModel model)
 {
     model.Name = model.Name.TrimStart(' ');
     model.Name = model.Name.TrimEnd(' ');
     return(Json(_countryManager.GetAll().Where(c => c.Name == model.Name && c.Id != model.Id).ToList().Count <= 0, JsonRequestBehavior.AllowGet));
 }
Пример #10
0
 public ActionResult <List <Country> > GetAll()
 {
     return(_countryManager.GetAll());// new string[] { "value1", "value2" };
 }