// GET: Customer public ActionResult ListCustomer(Int32?p) { var vm = new ListCustomerViewModel(); vm.Fill(CargarDatosContext(), p); return(View(vm)); }
public List <ListCustomerViewModel> GetCustomers() { var _db = new DbEl(); var customers = _db.Customers.OrderByDescending(i => i.DaySigned).ToList(); var list = new List <ListCustomerViewModel>(); foreach (var item in customers) { var model = new ListCustomerViewModel { SocialSecurity = item.SocialSecurity, CustomerId = item.CustomerId, Firstname = item.Firstname, Lastname = item.Lastname, Address = item.Address, City = item.City, Email = item.Email, Postnumber = item.Postnumber, ClientDeal = item.ClientModel != null ? item.ClientModel : null, ScrapeDeal = item.ScrapeModel != null ? item.ScrapeModel : null, Timestamp = item.DaySigned.ToString(), AreaCode = item.AreaCode != null ? item.AreaCode : null, HasConfirmed = item.HasConfirmed, IpAdress = item.IpAdress, LetUsGetInfo = item.LetUsGetInfo, Paymentmethod = item.Paymentmethod, PropertyCode = item.PropertyCode != null ? item.PropertyCode : null, StartDate = item.StartDate }; list.Add(model); } return(list); }
public ActionResult CustomerList() { /* * The below line gives us the list of all customers, however note that Entity framework * is not querying up the object as of now. */ var customers = _context.Customers.Include(c => c.MembershipType); // Customers is our DbSet var viewModel = new ListCustomerViewModel() { Customers = customers }; return(View(viewModel)); }
private ListCustomerViewModel GetCustomerViewModel(Customer customer) { var customerViewModel = new ListCustomerViewModel(customer, null, _dataService, _userRepository); foreach (var project in customer.Projects) { var gridProjectViewModel = GetProjectViewModel(project, customerViewModel); if (gridProjectViewModel != null) { customerViewModel.Children.Add(gridProjectViewModel); } } return(customerViewModel); }
public List <ListCustomerViewModel> GetTodaysCustomers() { var today = DateTime.Now.Date; var customers = db.Customers.ToList(); var filteredCustomer = customers.Where(i => i.DaySigned.Date == today); var list = new List <ListCustomerViewModel>(); foreach (var item in filteredCustomer) { var model = new ListCustomerViewModel { SocialSecurity = item.SocialSecurity, CustomerId = item.CustomerId, Firstname = item.Firstname, Lastname = item.Lastname, Address = item.Address, City = item.City, Email = item.Email, Postnumber = item.Postnumber, ClientDeal = item.ClientModel != null ? item.ClientModel : null, ScrapeDeal = item.ScrapeModel != null ? item.ScrapeModel : null, Timestamp = item.DaySigned.ToString(), AreaCode = item.AreaCode != null ? item.AreaCode : null, HasConfirmed = item.HasConfirmed, IpAdress = item.IpAdress, LetUsGetInfo = item.LetUsGetInfo, Paymentmethod = item.Paymentmethod, PropertyCode = item.PropertyCode != null ? item.PropertyCode : null, StartDate = item.StartDate }; list.Add(model); } return(list); }