static void Main(string[] args) { MercuryContext mercury = new MercuryContext(); foreach (var product in mercury.Products.Include("HistoricalPrices")) { Console.WriteLine(product); foreach (var price in product.HistoricalPrices.OrderByDescending(hp => hp.ChangeDate)) { Console.WriteLine($"\t{price.OldPrice}"); } Console.WriteLine("----------------------------------------------"); } }
static void Main(string[] args) { MercuryContext mercury = new MercuryContext(); //Product product = new Product() //{ // ProductName = "ETTAN", // Price = 51.0m //}; //mercury.Products.Add(product); //mercury.SaveChanges(); var productToUpdate = mercury.Products .FirstOrDefault(o => o.ProductName.ToLower() == "ettan"); //if(productToUpdate != null) //{ //productToUpdate.Price *= 0.9m; //mercury.SaveChanges(); //} bool done = false; while (!done) { HistoricalPrice hp = mercury .HistoricalPrices .FirstOrDefault(p => p.ProductsId == productToUpdate.Id); done = hp == null; if (!done) { mercury.HistoricalPrices.Remove(hp); mercury.SaveChanges(); } } mercury.Products.Remove(productToUpdate); mercury.SaveChanges(); }
public TaxrateController(MercuryContext context) { _context = context; }
public HomeController(ILogger <HomeController> logger, MercuryContext context) { _logger = logger; _context = context; }
public ClientController(MercuryContext context) { _context = context; }
public ConfigController(MercuryContext context) { _context = context; }
public CustomersService(MercuryContext context) { this.context = context; }
public EmployeeController(MercuryContext context) { _context = context; }
public MainService(MercuryContext context) { this.context = context; }
public AllocationController(MercuryContext context) { _context = context; }
public EmployeeHelper(MercuryContext context) { _context = context; }
public ConfigHelper(MercuryContext context) { _context = context; }
public SalarypackageController(MercuryContext context) { _context = context; }
public Authentication(MercuryContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public FinantialconditionController(MercuryContext context) { _context = context; }
public SalaryitemController(MercuryContext context) { _context = context; }