public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Colour,Weight,Priority")] Presents presents) { if (id != presents.ID) { return(NotFound()); } if (ModelState.IsValid) { try { //Csak a szin, es prioritas property lesz lementve _context.Attach(presents); _context.Entry(presents).Property(p => p.Colour).IsModified = true; _context.Entry(presents).Property(p => p.Priority).IsModified = true; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PresentsExists(presents.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(presents)); }
/// <summary> /// リストの作成 /// </summary> /// <param name="periodLoginMaster"></param> public void SetUpList(LoginBonusRecordListContext item) { SetCount(item.date_count); Presents.Clear(); for (int i = 0; i < item.present_ids.Length; ++i) { int presentID = item.present_ids[i]; MasterDataPresent presentMaster = MasterDataUtil.GetPresentParamFromID((uint)presentID); LoginBonusPresentListContext present = new LoginBonusPresentListContext(); MainMenuUtil.GetPresentIcon(presentMaster, sprite => { present.IconImage = sprite; }); present.NameText = MasterDataUtil.GetPresentName(presentMaster); present.NumText = string.Format(GameTextUtil.GetText("loginbonus_amount"), MasterDataUtil.GetPresentCount(presentMaster)); present.NumRate = GameTextUtil.GetText("loginbonus_multipled"); Presents.Add(present); } // 先頭のアイテムの線を非表示にする LoginBonusPresentListContext selectItem = Presents.First(); if (selectItem != null) { selectItem.IsViewBorder = false; } PresentItemCount = Presents.Count; }
public void Add(string c) { if (!Presents.TryGetValue(c, out int current)) { current = 0; } Presents[c] = ++current; }
public bool TryRemove(out string c) { if (!Presents.Any()) { c = default(string); return(false); } c = Presents.Keys.First(); if (--Presents[c] == 0) { Presents.Remove(c); } return(true); }
void CreatePresents() { GameObject presents = GameObject.CreatePrimitive(PrimitiveType.Cube); // Gameobjects are cubes presents.AddComponent <Presents> (); //Add the Presents script to each gameobject Presents toys = presents.GetComponent <Presents>(); //Create instance of Presents called toys float scale = Random.Range(0.5f, 0.75f); float _x = santa.transform.position.x; //Set starting position to Santa gameobject position float _y = santa.transform.position.y; // int c = Random.Range(0, 5); //Create a random value from 0,5 toys.Setpresents(_x, _y, scale, scale, 0.15f, Colours[c, 0], Colours[c, 1]); //List of parameters, Colours[c,0] referances the 1st row,Colours[c,1] the 2nd row of colours //So for e.g if c=2 we get a blue present [3,0] with white wrapping [3,1] if c=0 we get a red present [0,0] with cyan wrapping [0,1] }
public async Task <IActionResult> Create([Bind("ID,Name,Colour,Weight,Priority")] Presents presents) { if (ModelState.IsValid) { // Alert üzenet a Create ablakhoz már létező név esetén if (PresentsNameExists(presents.Name)) { ViewBag.Message = string.Format("Present with name: {0} already exists!", presents.Name); ViewBag.ShowDialog = true; } else { _context.Add(presents); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } return(View(presents)); }
public void AddWishesToTheList(string name, string present) { Presents newPresent = new Presents(name, present); presents.Add(newPresent); }