public ActionResult DeleteConfirmed(int id) { Miniature miniature = MiniatureDB.GetMiniatureById(id); MiniatureDB.DeleteMiniature(miniature); return(RedirectToAction("Index")); }
partial void Merge(Miniature entity, ItemDTO dto, object state) { if (dto.MiniPet != null) { entity.MiniatureId = dto.MiniPet.MiniPetId; } }
/// <inheritdoc /> public Item Convert(ItemDTO value, object state) { var entity = new Miniature(); this.Merge(entity, value, state); return(entity); }
public Miniature Update(Miniature updatedMiniature) { // get the ToDo object in the current list with this id var currentMiniature = _dbContext.Miniatures.Find(updatedMiniature.Id); // return null if todo to update isn't found if (currentMiniature == null) { return(null); } // NOTE: This method is already completed for you, but note // how the property values are copied below. // copy the property values from the changed todo into the // one in the db. NOTE that this is much simpler than individually // copying each property. _dbContext.Entry(currentMiniature) .CurrentValues .SetValues(updatedMiniature); // update the todo and save _dbContext.Miniatures.Update(currentMiniature); _dbContext.SaveChanges(); return(currentMiniature); }
public Miniature Update(Miniature updatedMiniature) { // update the todo and save var Miniature = _miniatureRepo.Update(updatedMiniature); return(Miniature); }
private void DeleteTag(string tag) { Miniature.DeleteTag(tag); Notify(nameof(OtherTags)); Notify(nameof(Tags)); Notify(nameof(ShowTags)); Notify(nameof(ShowNoTags)); }
private void AddTag(LambdaCommand arg1, object arg2) { Miniature.AddTag(AddedTag); Notify(nameof(OtherTags)); Notify(nameof(Tags)); Notify(nameof(ShowTags)); Notify(nameof(ShowNoTags)); }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); Image?.Dispose(); Image = null; Miniature?.Dispose(); Miniature = null; }
public ActionResult Edit([Bind(Include = "Miniid,Name,Price,Description,Year,GameName,Faction,Speed,Attack,Strength,HitPoints,Defense")] Miniature miniature) { if (ModelState.IsValid) { MiniatureDB.UpdateMiniature(miniature); return(RedirectToAction("Index")); } return(View(miniature)); }
public static MiniatureModel ToApiModel(this Miniature miniature) { return(new MiniatureModel { Id = miniature.Id, Name = miniature.Name, Game = miniature.Game, Keywords = miniature.Keywords?.Select(a => a.Name).ToArray() }); }
public Mini(GameObject mini) { Miniature m = mini.GetComponent <Miniature>(); miniatureId = m.GetMiniatureId(); attributes = m.GetAttributes(); x = mini.transform.position.x; y = mini.transform.position.y; z = mini.transform.position.z; }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); Miniature?.Dispose(); Freehand?.Dispose(); foreach (var drawable in Drawables) { drawable.Dispose(); } Drawables.Clear(); }
// GET: Miniatures/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Miniature miniature = MiniatureDB.GetMiniatureById(id); if (miniature == null) { return(HttpNotFound()); } return(View(miniature)); }
public void Awake() { Miniature mini_script = this.transform.parent.GetComponent <Miniature>(); Dictionary <string, string> attributes = mini_script.GetAttributes(); string name = "", size = "", hp = "", status = ""; attributes.TryGetValue("Name", out name); attributes.TryGetValue("Size", out size); attributes.TryGetValue("HP", out hp); attributes.TryGetValue("Status", out status); setFieldText("Name", name); setFieldText("Size", size); setFieldText("HP", hp); setFieldText("Affliction", status); }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); Miniature?.Dispose(); foreach (var drawing in Drawings) { drawing.Dispose(); } Drawings.Clear(); foreach (var tag in Tags) { tag.Dispose(); } Tags.Clear(); Players.Clear(); Teams.Clear(); Project = null; Storage = null; EventType = null; }
public void Remove(Miniature miniature) { // TODO: remove the Activity _miniatureRepo.Remove(miniature); }
public void Remove(Miniature Miniature) { _dbContext.Miniatures.Remove(Miniature); _dbContext.SaveChanges(); }
public void SetUp() { _player = Substitute.For <IPlayer>(); _miniature = new Miniature(_player); }
public Miniature Add(Miniature item) { _dbContext.Miniatures.Add(item); _dbContext.SaveChanges(); return(item); }
partial void Merge(Miniature entity, ItemDTO dto, object state) { entity.MiniatureId = dto.Details.MiniPetId; }
// Implement this method in a buddy class to set properties that are specific to 'Miniature' (if any) partial void Merge(Miniature entity, ItemDTO dto, object state);
public void updateAttr(string key, string value) { Miniature mini_script = this.transform.parent.GetComponent <Miniature>(); mini_script.SetAttribute(key, value); }
public Miniature Add(Miniature Miniature) { _miniatureRepo.Add(Miniature); return(Miniature); }
private void Start() { SL = GameObject.Find("SL").GetComponent <SAVELOAD>(); cameraMove = GetComponent <CameraMove>(); admob = GetComponent <ADMOBManager>(); rCam = GameObject.Find("RatingCamera"); sCam = GameObject.Find("SpaceCamera"); pCam = GameObject.Find("PlanetCamera"); Planet = GameObject.Find("PlanetLevel"); Space = GameObject.Find("CanvasSpaces"); Rating = GameObject.Find("CanvasRatings"); UI = GameObject.Find("CanvasUI"); CanvasSpace = UI.transform.Find("CanvasSpace").gameObject; CanvasRating = UI.transform.Find("CanvasRating").gameObject; CanvasPlanet = UI.transform.Find("CanvasPlanet").gameObject; objTable = GameObject.Find("Table"); objBlack = CanvasPlanet.transform.Find("Black").gameObject; objHint = CanvasPlanet.transform.Find("Hint").gameObject; Score = CanvasPlanet.transform.Find("Overlay/Score").GetComponent <Score>(); statistic = CanvasPlanet.transform.Find("Overlay/Statistic").GetComponent <Statistic>(); objBonusF = CanvasPlanet.transform.Find("Overlay/BonusF").gameObject; objBonusR = CanvasPlanet.transform.Find("Overlay/BonusR").gameObject; objBonusC = CanvasPlanet.transform.Find("Overlay/BonusC").gameObject; PlanetInfo = Planet.GetComponent <PlanetInfo>(); Mines = Planet.transform.Find("Mines").GetComponent <Mines>(); objEl = Planet.transform.Find("Up/Elevator").gameObject; objFac = Planet.transform.Find("Up/Factory").gameObject; objLab = Planet.transform.Find("Up/Lab").gameObject; objStock = Planet.transform.Find("Up/Stock").gameObject; objBoer = Planet.transform.Find("Up/Boer").gameObject; objRock = Planet.transform.Find("Up/RocketPlace").gameObject; objRJ = Planet.transform.Find("RobotEnginer").gameObject; Miniature = Planet.transform.Find("Miniature").GetComponent <Miniature>(); objBat = Planet.transform.Find("Miniature/BatteryF").gameObject; Builds = Planet.transform.Find("Up").GetComponentsInChildren <Builds>(); cameraUpDown = objEl.GetComponent <CameraUpDown>(); BuySourse = Planet.transform.Find("Up").GetComponent <AudioSource>(); BonusSourse = Planet.transform.Find("Mines").GetComponent <AudioSource>(); MineSource = Planet.GetComponent <AudioSource>(); CrashSource = Planet.transform.Find("Up/Forest").GetComponent <AudioSource>(); BtnSource = GameObject.Find("CanvasUI").GetComponent <AudioSource>(); DynSource = Planet.transform.Find("bgPlanet0").GetComponent <AudioSource>(); ErrorSource = GameObject.Find("SL").GetComponent <AudioSource>(); Elevator = objStock.GetComponent <Elevator>(); Factory = objFac.GetComponent <Factory>(); Rocket = objRock.GetComponent <Rocket>(); btnL = objLab.transform.Find("Btn").gameObject; iconBtnL = btnL.transform.GetComponentInChildren <Button>(); btnE = objStock.transform.Find("Btn").gameObject; iconBtnE = btnE.transform.GetComponentInChildren <Button>(); btnF = objFac.transform.Find("Btn").gameObject; iconBtnF = btnF.transform.GetComponentInChildren <Button>(); btnR = objRock.transform.Find("Btn").gameObject; iconBtnR = btnR.transform.GetComponentInChildren <Button>(); table = GetComponent <Table>(); objRegTableCont = objTable.transform.Find("RegisterContent").gameObject; objBonusTableCont = objTable.transform.Find("BonusContent").gameObject; objRatingTableCont = objTable.transform.Find("RatingContent").gameObject; displayPlayers = Rating.GetComponent <DisplayPlayers>(); ContentRating = Rating.transform.Find("Scroll View/Viewport/Content"); addUser = Rating.GetComponent <AddUser>(); cameraMove.enabled = false; // table.Load(); // cameraUpDown.Load(); // PlanetInfo.Load(); // SL.Load(); //Score.Load(); rCam.SetActive(false); sCam.SetActive(false); pCam.SetActive(false); Planet.SetActive(false); Rating.SetActive(false); CanvasRating.SetActive(false); CanvasPlanet.SetActive(false); objTable.SetActive(false); objBlack.SetActive(false); objHint.SetActive(false); objBonusF.SetActive(false); objBonusR.SetActive(false); objBonusC.SetActive(false); }
public static async Task GetItems() { List <Item> allItems = new List <Item>(); List <int> allIds = apiOperations.GetAllIds(ITEMS_SUFFIX); Console.WriteLine($"Got {allIds.Count} items Ids"); for (int i = 0; i < allIds.Count; i += 200) { IEnumerable <int> idsToDownload = allIds.Skip(i).Take(200); StringBuilder endpoint = new StringBuilder(ITEMS_SUFFIX).Append("?ids="); foreach (var id in idsToDownload) { endpoint.Append(id) .Append(','); } endpoint.Length--; List <APIResult <Item> > result = apiOperations.GetObjectsByIds <Item>(endpoint.ToString()); foreach (var apiItem in result) { Item itemToAdd = apiItem.ResultObject; switch (itemToAdd.Type) { case "Armor": Armor armor = JsonConvert.DeserializeObject <Armor>(apiItem.AdditionalDetails); armor.Id = itemToAdd.Id; itemToAdd.Armor = armor; itemToAdd.ArmorId = armor.Id; dbOperations.AddWithoutCommit <Armor>(armor); break; case "Weapon": Weapon weapon = JsonConvert.DeserializeObject <Weapon>(apiItem.AdditionalDetails); weapon.Id = itemToAdd.Id; itemToAdd.Weapon = weapon; itemToAdd.WeaponId = weapon.Id; dbOperations.AddWithoutCommit <Weapon>(weapon); break; case "Back": BackItem backItem = JsonConvert.DeserializeObject <BackItem>(apiItem.AdditionalDetails); if (backItem == null) { backItem = new BackItem(); } backItem.Id = itemToAdd.Id; itemToAdd.BackItem = backItem; itemToAdd.BackItemId = backItem.Id; dbOperations.AddWithoutCommit <BackItem>(backItem); break; case "Consumable": Consumable consumable = JsonConvert.DeserializeObject <Consumable>(apiItem.AdditionalDetails); consumable.Id = itemToAdd.Id; itemToAdd.Consumable = consumable; itemToAdd.ConsumableId = consumable.Id; dbOperations.AddWithoutCommit <Consumable>(consumable); break; case "Container": Container container = JsonConvert.DeserializeObject <Container>(apiItem.AdditionalDetails); container.Id = itemToAdd.Id; itemToAdd.Container = container; itemToAdd.ContainerId = container.Id; dbOperations.AddWithoutCommit <Container>(container); break; case "Gathering": GatheringTool gathering = JsonConvert.DeserializeObject <GatheringTool>(apiItem.AdditionalDetails); gathering.Id = itemToAdd.Id; itemToAdd.GatheringTool = gathering; itemToAdd.GatheringToolId = gathering.Id; dbOperations.AddWithoutCommit <GatheringTool>(gathering); break; case "Gizmo": Gizmo gizmo = JsonConvert.DeserializeObject <Gizmo>(apiItem.AdditionalDetails); gizmo.Id = itemToAdd.Id; itemToAdd.Gizmo = gizmo; itemToAdd.GizmoId = gizmo.Id; dbOperations.AddWithoutCommit <Gizmo>(gizmo); break; case "MiniPet": Miniature mini = JsonConvert.DeserializeObject <Miniature>(apiItem.AdditionalDetails); mini.Id = itemToAdd.Id; itemToAdd.Miniature = mini; itemToAdd.MiniatureId = mini.Id; dbOperations.AddWithoutCommit <Miniature>(mini); break; case "Tool": SalvageKit salvage = JsonConvert.DeserializeObject <SalvageKit>(apiItem.AdditionalDetails); salvage.Id = itemToAdd.Id; itemToAdd.SalvageKit = salvage; itemToAdd.SalvageKitId = salvage.Id; dbOperations.AddWithoutCommit <SalvageKit>(salvage); break; case "Trinket": Trinket trinket = JsonConvert.DeserializeObject <Trinket>(apiItem.AdditionalDetails); trinket.Id = itemToAdd.Id; itemToAdd.Trinket = trinket; itemToAdd.TrinketId = trinket.Id; dbOperations.AddWithoutCommit <Trinket>(trinket); break; case "UpgradeComponent": UpgradeComponent upgrade = JsonConvert.DeserializeObject <UpgradeComponent>(apiItem.AdditionalDetails); upgrade.Id = itemToAdd.Id; itemToAdd.UpgradeComponent = upgrade; itemToAdd.UpgradeComponentId = upgrade.Id; dbOperations.AddWithoutCommit <UpgradeComponent>(upgrade); break; default: break; } allItems.Add(apiItem.ResultObject); } Console.WriteLine($"Loaded {allItems.Count} out of {allIds.Count} items"); } await dbOperations.AddToEntity <Item>(allItems); Console.WriteLine("Getting items completed"); }