public IActionResult Add(Host host)
        {
            var result = _hostService.Add(host);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Example #2
0
 private async Task Add()
 {
     if (PortToCreate != null && SmtpToCreate != null)
     {
         var newHost = new Host()
         {
             Server = SmtpToCreate, Port = int.Parse(PortToCreate)
         };
         _hostService.Add(newHost);
         Hosts = new ObservableCollection <Host>(_hostService.GetAll());
         Messenger.Default.Send(newHost);
     }
 }