/// <summary> /// Modifies an element of the knifeStore list as intended. /// </summary> /// <param name="reviewToModify">The Reveiew entity which should be modified.</param> public void ModReview(Review reviewToModify, string token) { if (reviewToModify == null) { this.messengerService.Send("EDIT FAILED", "LogicResult"); return; } Review clone = new Review(); clone.CopyFrom(reviewToModify); if (this.editorService.EditReview(clone) == true) { try { reviewToModify.CopyFrom(clone); Velemeny kb = new Velemeny() { Velemeny_Id = string.Empty, VelemenySzovege = clone.ReviewText == null ? string.Empty : clone.ReviewText, Elegedettseg = clone.Rating, Szerzo = clone.Author == null ? string.Empty : clone.Author, Gyartasi_Cikkszam = clone.SerialNumber, }; string api = hostSettings.Address() + $"Review" + $"/{reviewToModify.ReviewId}"; try { WebClient wc = new WebClient(); var json = JsonConvert.SerializeObject(kb); wc.Headers[HttpRequestHeader.ContentType] = "application/json"; wc.Headers[HttpRequestHeader.Authorization] = $"Bearer {token}"; 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; } catch { this.messengerService.Send("MÓDOSÍTÁS SIKERTELEN", "LogicResult"); return; } } }