public ActionResult Create(Product product) { try { // TODO: Add insert logic here client.AddProduct(product); return(RedirectToAction("Index")); } catch { return(View()); } }
public AddProductResult AddProduct(string url, string token, EncryptionInfo encryptionInfo, KeyPair serviceKeys, ServiceProduct product) { ProductsServiceClient client = ProductClientCreator(url); string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo); string serializedPayload = _objectSerializationProvider.Serialize(product); string encryptedData = _asymmetricEncryptionProvider.EncryptPrivate(serializedPayload, serviceKeys); string encryptedResult = client.AddProduct(encryptedToken, encryptedData); string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys); AddProductResult result = _objectSerializationProvider.Deserialize <AddProductResult>(decryptedResult); return(result); }