private void OnMessageReceived(object sender, MessageReceivedEventArgs args) { var item = new ReminderItem( Guid.NewGuid(), ReminderItemStatus.Created, args.Message.DateTime, args.Message.Text, args.ContactId ); _storage.AddAsync(item); }
private void OnMessageReceived(object sender, MessageReceivedEventArgs args) { _logger.LogDebug("Received message from receiver"); var item = new ReminderItem( Guid.NewGuid(), ReminderItemStatus.Created, args.Message.DateTime, args.Message.Text, args.ContactId ); _ = _storage.AddAsync(item); _logger.LogInformation($"Created reminder {item.Id:N}"); }
public async Task <IActionResult> Create([FromBody] CreateReminderViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var item = new ReminderItem( model.Id ?? Guid.NewGuid(), model.Status, model.DateTime, model.Message, model.ContactId); await _storage.AddAsync(item); return(CreatedAtAction("Get", new { id = item.Id }, item)); }