Пример #1
0
 public async Task <IActionResult> Add(ModelAppSincService _appSincService)
 {
     try
     {
         return(Ok(await _repository.AddAsynch(_appSincService)));
     }
     catch (Exception err)
     {
         if (err.InnerException != null)
         {
             return(BadRequest(err.Message + "\n" + err.InnerException.Message));
         }
         return(BadRequest(err.Message));
     }
 }
Пример #2
0
        public async Task <IActionResult> AddUpdate(ModelAppSincService _appSincService)
        {
            try
            {
                ModelAppSincService newAppSincService = await _repository.FindAsynch(_appSincService.AppSincServicesId);

                if (newAppSincService == null)
                {
                    await _repository.AddAsynch(_appSincService);

                    return(Ok(_appSincService.AppSincServicesId));
                }
                else
                {
                    newAppSincService.AddressName             = _appSincService.AddressName;
                    newAppSincService.AppSincServicesId       = _appSincService.AppSincServicesId;
                    newAppSincService.CustomersProductsId     = _appSincService.CustomersProductsId;
                    newAppSincService.InstallDirectory        = _appSincService.InstallDirectory;
                    newAppSincService.IpAddress               = _appSincService.IpAddress;
                    newAppSincService.IsCreated               = _appSincService.IsCreated;
                    newAppSincService.SynchronizerServiceName = _appSincService.SynchronizerServiceName;
                    newAppSincService.Port = _appSincService.Port;

                    await _repository.UpdateAsynch(newAppSincService);

                    return(Ok(newAppSincService.AppSincServicesId));
                }
            }
            catch (Exception err)
            {
                if (err.InnerException != null)
                {
                    return(BadRequest(err.Message + "\n" + err.InnerException.Message));
                }
                return(BadRequest(err.Message));
            }
        }