public async Task <IActionResult> Add(ModelAppSincWeb _appSincWeb) { try { return(Ok(await _repository.AddAsynch(_appSincWeb))); } catch (Exception err) { if (err.InnerException != null) { return(BadRequest(err.Message + "\n" + err.InnerException.Message)); } return(BadRequest(err.Message)); } }
public async Task <IActionResult> AddUpdate(ModelAppSincWeb _appSincWeb) { try { ModelAppSincWeb newAppSincWeb = await _repository.FindAsynch(_appSincWeb.AppSincWebsId); if (newAppSincWeb == null) { await _repository.AddAsynch(_appSincWeb); return(Ok(_appSincWeb.AppSincWebsId)); } else { newAppSincWeb.AddressName = _appSincWeb.AddressName; newAppSincWeb.AppSincWebsId = _appSincWeb.AppSincWebsId; newAppSincWeb.CustomersProductsId = _appSincWeb.CustomersProductsId; newAppSincWeb.InstallDirectory = _appSincWeb.InstallDirectory; newAppSincWeb.IpAddress = _appSincWeb.IpAddress; newAppSincWeb.IsCreated = _appSincWeb.IsCreated; newAppSincWeb.Port = _appSincWeb.Port; await _repository.UpdateAsynch(newAppSincWeb); return(Ok(newAppSincWeb.AppSincWebsId)); } } catch (Exception err) { if (err.InnerException != null) { return(BadRequest(err.Message + "\n" + err.InnerException.Message)); } return(BadRequest(err.Message)); } }