12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ProbnikDemo
- {
- public partial class Agent
- {
-
- public string BackGround { get; set; }
- public string AgentTypes { get; set; }
- public string CountSale { get; set;}
- public List<Agent> Agents()
- {
- List<Agent> agents = BaseConnect.BaseModel.Agent.ToList();
- List<ProductSale> productSales = BaseConnect.BaseModel.ProductSale.ToList();
- List<Product> products = BaseConnect.BaseModel.Product.ToList();
- Random r = new Random();
- foreach (Agent a in agents)
- {
- AgentType agentType = BaseConnect.BaseModel.AgentType.FirstOrDefault(x => x.ID == a.AgentTypeID);
- a.AgentTypes = agentType.Title;
- foreach (ProductSale sales in productSales)
- {
- if (a.ID == sales.AgentID)
- {
- a.CountSale = Convert.ToString(sales.ProductCount);
- if (CountSale == "")
- {
- CountSale = "20";
- }
- }
- }
-
- }
- return agents;
- }
- }
- }
|