Exemple #1
0
        public async Task <IActionResult> PutRequesterModel(Guid id, RequesterModel requesterModel)
        {
            if (id != requesterModel.RequesterId)
            {
                return(BadRequest());
            }

            _context.Entry(requesterModel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RequesterModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <RequesterModel> > PostRequesterModel(RequesterModel requesterModel)
        {
            _context.RequesterModel.Add(requesterModel);
            await _context.SaveChangesAsync();

            _domain.notifyRequest(requesterModel);

            return(CreatedAtAction("GetRequesterModel", new { id = requesterModel.RequesterId }, requesterModel));
        }
        public async void notifyRequest(RequesterModel model)
        {
            var client = _clientFactory.CreateClient("BrokerService");

            var content = JsonConvert.SerializeObject(model);

            var stringContent = new StringContent(content, Encoding.UTF8, "application/json");

            await client.PostAsync(client.BaseAddress + "Broker/Request", stringContent);
        }