Пример #1
0
        public async Task <ActionResult <List <int> > > Add([FromBody] NeuronDto neuronDto)
        {
            this.logger.LogInformation($"POST {neuronDto.Information}");

            var neuron = new Neuron(neuronDto.Information)
            {
                Id     = neuronDto.Id,
                Groups = neuronDto.Groups
            };

            var reminders = neuronDto.Reminders.ToArray();
            var success   = neuron.SetReminders(reminders, out _, out List <DateTimeOffset> errors);

            await this.neuronRepository.AddAsync(neuron);

            if (success)
            {
                return(NoContent());
            }
            else
            {
                return(Ok(new { ErrorIndices = errors }));
            }
        }
Пример #2
0
 public void Put(int id, [FromBody] NeuronDto neuronDto)
 {
     this.logger.LogInformation($"PUT {id} -> {neuronDto?.Information}");
 }