/// <summary>
        /// Get All Partners.
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public IResult GetAllPartners(SearchSortModel search)
        {
            if (string.IsNullOrEmpty(search.SortColumn))
            {
                search.SortColumn = Constants.CreatedDate;
            }
            var result = new Result
            {
                Operation = Operation.Read,
                Status    = Status.Success
            };

            try
            {
                var partnerViewModels = new List <PartnerViewModel>();
                var allPartner        = _partnerRepository.GetAllPartners(search);
                if (allPartner != null && allPartner.Any())
                {
                    search.SearchResult = partnerViewModels.MapFromModel <Partner, PartnerViewModel>(allPartner);
                }
                else
                {
                    search.SearchResult = partnerViewModels;
                    result.Message      = CommonErrorMessages.NoResultFound;
                }
                result.Body = search;
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Fail;
            }
            return(result);
        }
 public ActionResult Index()
 {
     try
     {
         return(View(_partnerRepository.GetAllPartners(int.Parse(Session["partnerId"].ToString()))));
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.Message;
         return(View("Error"));
     }
 }
Example #3
0
        public IActionResult Create()
        {
            var model = new HoroscopeViewModel();

            model.UserList = _customerRepository.GetAll()
                             .Select(x => new SelectListItem
            {
                Value    = x.UserId.ToString(),
                Text     = x.UserName,
                Selected = true
            }).ToList();

            model.PartnerList = _partnerRepository.GetAllPartners()
                                .Select(x => new SelectListItem
            {
                Value    = x.Id.ToString(),
                Text     = x.Email,
                Selected = true,
            }).ToList();
            return(View(model));
        }
        public IActionResult Index()
        {
            var Partners = _PartnerRepository.GetAllPartners();

            return(View(Partners));
        }