예제 #1
0
        public ActionResult Index()
        {
            IndexCustomerViewModel custs = new IndexCustomerViewModel();

            custs.Customers = _context.Customers.Include(c => c.MembershipType).ToList();

            return(View(custs));
        }
예제 #2
0
        public ViewResult Index()
        {
            //var customers = GetCustomers().ToList();

            var customers = _context.Customers.Include(c => c.MembershipType).ToList(); //Obtain customer list from DB.
            var indexcustomerviewmodel = new IndexCustomerViewModel()
            {
                Customers = customers
            };

            return(View(indexcustomerviewmodel));
        }
예제 #3
0
        // GET: Customers
        public ActionResult Index()
        {
            var customers = new List <Customer> {
                new Customer {
                    Name = "John Smith"
                },
                new Customer {
                    Name = "Mary Williams"
                }
            };

            var viewModel = new IndexCustomerViewModel {
                Customers = customers
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> EditCurrentMortgage()
        {
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var customer = await _context.Customers.Where(c => c.IdentityUserId == userId)
                           .FirstOrDefaultAsync();

            if (customer == null)
            {
                return(NotFound());
            }

            IndexCustomerViewModel indexCustomerViewModel = new IndexCustomerViewModel()
            {
                Customer = customer
            };

            return(View(indexCustomerViewModel));
        }
        public async Task <IActionResult> Index(string customerGroupId, string customerAccount)
        {
            var model = new IndexCustomerViewModel
            {
                CustomerGroupId = customerGroupId,
                CustomerAccount = customerAccount
            };

            if (string.IsNullOrEmpty(customerGroupId))
            {
                model.Customers = await odataService.GetCustomers();
            }
            else
            {
                model.Customers = await odataService.GetCustomersByGroup(customerGroupId);
            }

            return(View(model));
        }
예제 #6
0
        public IEnumerable <IndexCustomerViewModel> GetCustomers([FromRoute] int companyId)
        {
            List <Customer> providers          = _context.Customers.Where(x => x.Enabled == true && x.CompanyId == companyId).Include(x => x.Cities).ToList();
            List <IndexCustomerViewModel> list = new List <IndexCustomerViewModel>();

            foreach (var item in providers)
            {
                IndexCustomerViewModel model = new IndexCustomerViewModel
                {
                    Address        = item.Address,
                    CountryId      = item.CountryId,
                    StateId        = item.StateId,
                    CityId         = item.CityId,
                    City           = item.Cities?.Description,
                    DateInitial    = item.DateInitial,
                    Documento      = item.Documento,
                    DocumentTypeId = item.DocumentTypeId,
                    Email          = item.Email,
                    Enabled        = item.Enabled,
                    Favorite       = item.Favorite,
                    Id             = item.Id,
                    Observation    = item.Observation,
                    Phone          = item.Phone,
                    Names          = item.Names,
                    PriceListId    = item.PriceListId
                };

                if (!string.IsNullOrEmpty(item.Logo))
                {
                    byte[] imageArray = System.IO.File.ReadAllBytes(@item.Logo);
                    string base64ImageRepresentation = Convert.ToBase64String(imageArray);
                    model.Logo = "data:image/png;base64," + base64ImageRepresentation;
                }

                list.Add(model);
            }

            return(list.OrderBy(x => x.Names));
        }