private void InitMachine() { var machine = new VendingMachine(); machine.InitMachine(); MachineMemoryManager.InsertMachine(machine); }
public override void ProcessRequest(HttpContext context) { var machine = MachineMemoryManager.Instance(); var userBug = UserBugMemoryManager.Instance(); machine.PayOut(userBug); MachineMemoryManager.InsertMachine(machine); UserBugMemoryManager.InsertBug(userBug); WriteResult(context.Response, new { Result = true, UserBug = userBug }); }
public override void ProcessRequest(HttpContext context) { var coin = JsonConvert.DeserializeObject <CoinModel>(context.Request.QueryString["coin"]); var machine = MachineMemoryManager.Instance(); var userBug = UserBugMemoryManager.Instance(); bool result = userBug.InsertCoinToMachine(machine, coin); MachineMemoryManager.InsertMachine(machine); UserBugMemoryManager.InsertBug(userBug); WriteResult(context.Response, new { Result = result, UserSumRur = machine.UserSumRur }); }
public override void ProcessRequest(HttpContext context) { var productType = (ProductTypeEnum)Convert.ToInt32(context.Request.QueryString["productType"]); var machine = MachineMemoryManager.Instance(); var result = machine.BuyProduct(productType); MachineMemoryManager.InsertMachine(machine); var port = machine.GetPortForProduct(productType); WriteResult(context.Response, new { Result = result.Result, Message = result.Message, UserSumRur = machine.UserSumRur, ProductCount = port.ProductCount }); }
protected string WriteMachineToJs() { return(JsonConvert.SerializeObject(MachineMemoryManager.Instance(), Formatting.Indented)); }