/// <summary> /// Modifies an element of the knifeStore list as intended. /// </summary> /// <param name="knifeStoreToModify">The KnifeStore entity which should be modified.</param> public void ModKnifeStore(KnifeStore knifeStoreToModify, string token) { if (knifeStoreToModify == null) { this.messengerService.Send("MÓDOSÍTÁS SIKERTELEN", "LogicResult"); return; } KnifeStore clone = new KnifeStore(); clone.CopyFrom(knifeStoreToModify); if (this.editorService.EditKnifeStore(clone) == true) { knifeStoreToModify.CopyFrom(clone); Kes_Bolt kb = new Kes_Bolt() { Raktar_Id = clone.StorageId, Bolt_Nev = clone.Name, Cim = clone.Address, Weboldal = clone.Website, }; string api = hostSettings.Address() + $"KnifeStore" + $"/{knifeStoreToModify.StorageId}"; try { WebClient wc = new WebClient(); var json = JsonConvert.SerializeObject(kb); wc.Headers[HttpRequestHeader.Authorization] = $"Bearer {token}"; wc.Headers[HttpRequestHeader.ContentType] = "application/json"; wc.UploadString(api, "PUT", json); } catch (Exception ex) { if (ex.Message.ToString().Contains("403")) { this.messengerService.Send("MÓDOSÍTÁS SIKERTELEN\nNINCS ENGEDÉLYE EHHEZ", "LogicResult"); return; } this.messengerService.Send("MÓDOSÍTÁS SIKERTELEN", "LogicResult"); return; } //this.knifeStoreLogic.UpdateKes_Bolt(knifeStoreToModify.StorageId, kb); this.messengerService.Send("MÓDOSÍTÁS SIKERES", "LogicResult"); return; } this.messengerService.Send("MÓDOSÍTÁS MEGSZAKÍTVA", "LogicResult"); }