public static void Write(this EquipmentUpdate equipment) { if (equipment.Equipment != null) { PCSX2.Write(GAMESTATE_EQUIPMENT, equipment.Equipment); } }
public async Task <bool> UpdateEquipment(EquipmentUpdate equipment) { var json = JsonConvert.SerializeObject(equipment); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await httpClient.PutAsync($"{URL}/{equipment.Id}", content); return(response.IsSuccessStatusCode); }
protected override void OnEquipmentUpdate(EquipmentUpdate equipment) { // base.OnEquipmentUpdate(equipment); // equipment.Write(); }
public static void Read(this EquipmentUpdate equipment) { if (equipment.Equipment == null || equipment.Equipment.Length != GAMESTATE_EQUIPMENT_SIZE) { equipment.Equipment = new byte[GAMESTATE_EQUIPMENT_SIZE]; } // Read PCSX2.Read(GAMESTATE_EQUIPMENT, equipment.Equipment, GAMESTATE_EQUIPMENT_SIZE); }
private async Task saveEquipment() { if (Id == null) { var equipment = new EquipmentPost() { Name = Name, Quantity = Quantity, Status = 1, StatusName = "Active", Type = SelectedType.Id, TypeName = SelectedType.TypeName }; try { var isCreated = await _restServices.PostEquipment(equipment); if (isCreated) { var result = await CoreMethods.DisplayAlert("Hi", "Your record has been added successfully......", "Alright", "Cancel"); if (result) { await CoreMethods.PushPageModel <EquipmentPageModel>(); } } else { await CoreMethods.DisplayAlert("Opps", "Something went wrong......", "Ok"); } } catch (Exception) { //log errors here throw; } } else { var equipment = new EquipmentUpdate() { Id = Id, Name = Name, Quantity = Quantity, Status = 1, StatusName = "Active", Type = SelectedType.Id, TypeName = SelectedType.TypeName }; var isUpdated = await _restServices.UpdateEquipment(equipment); if (isUpdated) { var result = await CoreMethods.DisplayAlert("Hi", "Your record has been updated successfully......", "Alright", "Cancel"); if (result) { await CoreMethods.PushPageModel <EquipmentPageModel>(); } } else { await CoreMethods.DisplayAlert("Opps", "Something went wrong......", "Ok"); } } }
protected virtual void OnEquipmentUpdate(EquipmentUpdate equipment) { }
public async void Update(Equipment original, EquipmentUpdate update) => await _equipment.ReplaceOneAsync(equipment => equipment.Id == original.Id, Equipment.FromUpdate(original, update));
public async Task <IActionResult> Update([FromHeader] string authToken, string id, EquipmentUpdate update) { if (!await _authenticationService.CheckAccess(authToken, "equipmentMgr")) { return(Unauthorized()); } Equipment equipment = await _equipmentService.Get(id); if (equipment == null) { return(NotFound()); } _equipmentService.Update(equipment, update); await _logService.Create(new Log( null, AuthenticationHelpers.GetUserIdFromToken(authToken), DateTime.UtcNow, "Document modified.", "equipment", id, JsonSerializer.Serialize(Equipment.FromUpdate(equipment, update)) )); return(Ok()); }