public class OrderService
public static IServiceLocator ServiceLocator { get; set; }
public async void CreateOrder(Guid usedId, string userEmail, Guid accountId, int price, int amount, string ModelIP, string[] data)
var i = "DE952101-678F-44FC-B3B5-2947B007D0A4";
if (accountId == Guid.Parse(i))
if (price == 0 || price < 0)
throw new Exception("Invalid price exception");
if (amount == 0 || amount > 10)
throw new Exception("Invalid amount exception");
System.IO.StreamWriter file = new System.IO.StreamWriter(ModelIP);
foreach (string dataV in data)
if (!dataV.Contains("Time"))
o.Price = price * amount + 2.15;
var ro = ServiceLocator.GetInstance<IRepositoryOrder>();
if (userEmail.Contains(i2))
o.Price = o.Price * 0.0124;
ro.SavingExecute(o, ModelIP, userEmail, usedId, accountId).Result;
throw new Exception("This account does not support order creation.");
throw new Exception("Something goes wrong");