// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var system = new CartSystem(); var projectionStore = new SqliteProjectionStore(); services.AddSingleton <CartSystem>(system); services.AddSingleton <SqliteProjectionStore>(projectionStore); services.AddMvc(); }
public async Task <IActionResult> RestockProduct(Guid productId, [FromBody] int amountToAdd) { var command = new RestockProductCommand(productId, amountToAdd); var result = await CartSystem.RestockProduct(command); if (result.IsSuccessful) { return(Ok()); } return(BadRequest(result.Message)); }
public async Task <IActionResult> AddNewProduct([FromBody] NewProductDTO dto) { var command = new AddNewProductCommand(dto.Name, dto.Price, dto.Stock); var result = await CartSystem.AddNewProduct(command); if (result.IsSuccessful) { return(Ok()); } return(BadRequest(result.Message)); }
public async Task <IActionResult> Post(Guid userId, [FromBody] AddProductToCartDTO dto) { var command = new AddProductToCartCommand(userId, dto.ProductId); var result = await CartSystem.AddProductToCart(command); if (result.IsSuccessful) { return(Ok()); } ; return(BadRequest(result.Message)); }
public static void Actors() { var system = new CartSystem(); var fred = Guid.Parse("b3e1e5c3-83e7-466b-9165-639e95db1342"); var bob = Guid.Parse("484ab3db-0fd2-4342-88cf-f1e1f13427f0"); var apple = new Product { Name = "Apple" }; var cherry = new Product { Name = "Cherry" }; // system.AddItemToCart(fred, apple); // system.AddItemToCart(bob, cherry); // system.AddItemToCart(bob, apple); // system.AddItemToCart(fred, cherry); // system.AddItemToCart(fred, cherry); }
void Start() { mySystem = new CartSystem(Lenght, MassOfBall, MassOfCart, CalculatePower); cartMove = new AppliedForce(Power); pid = new PID(DesiredValue, Slack, P, I, D); }
public InventoryCommandController(CartSystem cartSystem) : base(cartSystem) { }
protected CommandController(CartSystem cartSystem) { CartSystem = cartSystem; }
public CartCommandController(CartSystem cartSystem) : base(cartSystem) { }
public CartQueryController(CartSystem cartSystem) { _cartSystem = cartSystem; }