Esempio n. 1
0
        public async Task <ActionResult <Demand> > CreateDemand([FromBody] Demand demand)
        {
            await _repository.Create(demand);

            // Dictionary<string, object> headers = new Dictionary<string, object>();
            // headers.Add("create", "create");
            // publisher.Publish(JsonConvert.SerializeObject(demand), "demand.create", headers);
            this.PublishEvent("create", "company.demand", demand: demand);
            this.PublishEvent("create", "customer.demand", demand: demand);

            return(CreatedAtAction("GetDemands", new { demand.Id }, demand)); //CreatedAtRoute("GetDemand", new { id = demand.Id}, demand);
        }