public async Task <IActionResult> PostHeaAgents([FromBody] Agent agent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var agentOut = await _repository.Create(agent); //_logger.LogInformation("Created Agent success!"); return(CreatedAtAction("GetHeaAgents", new { id = agentOut.Id }, agentOut)); }
public async Task <ActionResult> Create([Bind] Agent agent) { logger.Info($"Action Start | Controller name: {nameof(AgentsController)} | Action name: {nameof(Create)} | Input params: {nameof(agent.Name)}={agent.Name}, {nameof(agent.Login)}={agent.Login}, {nameof(agent.IsAlgorithmAllowServiceLevel)}={agent.IsAlgorithmAllowServiceLevel}, {nameof(agent.WorkloadMaxContactsCount)}={agent.WorkloadMaxContactsCount}, {nameof(agent.GroupId)}={agent.GroupId} "); if (ModelState.IsValid) { repository.Create(agent); await repository.SaveAsync(); return(RedirectToAction("Index")); } return(View(agent)); }