コード例 #1
0
        public async Task <ActionResult <Idols> > PostIdols(Idols idols)
        {
            _context.Idols.Add(idols);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetIdols", new { id = idols.ID }, idols));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Image,Description,Gender,Phone,Email,Status,Price,Star")] Idols idol)
        {
            if (id != idol.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(idol);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IdolExists(idol.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(idol));
        }
コード例 #3
0
        public async Task <int> SaveIdolsAsync(IEnumerable <Idol> idols)
        {
            var idolDictionary = idols.ToDictionary(_ => _.Id);

            var dbIdols = await Idols.ToDictionaryAsync(_ => _.Id);

            var c = 0;

            foreach (var kv in idolDictionary)
            {
                Idol dbIdol;
                if (dbIdols.TryGetValue(kv.Key, out dbIdol))
                {
                    // 更新しない
                    //dbIdol.Name = kv.Value.Name;
                    //dbIdol.Kana = kv.Value.Kana;
                }
                else
                {
                    Idols.Add(kv.Value);
                    c++;
                }
            }

            await SaveChangesAsync();

            return(c);
        }
コード例 #4
0
        public async Task <IActionResult> PutIdols(int id, Idols idols)
        {
            if (id != idols.ID)
            {
                return(BadRequest());
            }

            _context.Entry(idols).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IdolsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #5
0
 private void AddToOwned()
 {
     foreach (var x in SelectedIdols.Cast <Idol>())
     {
         m_config.OwnedIdols.Add(new OwnedIdol(m_config.GetNextLid(), x));
     }
     m_config.Save();
     if (Filter.FilterOwned)
     {
         Idols.Refresh();
     }
 }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("ID,Name,Image,Description,Gender,Phone,Email,Status,Price,Star")] Idols idol)
        {
            if (ModelState.IsValid)
            {
                if (IdolEmailExists(idol.Email))
                {
                    ViewBag.error = "You are already an Idol";
                    return(View());
                }
                else
                {
                    _context.Add(idol);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View(idol));
        }
コード例 #7
0
        public void UpdateInventoryCategories()
        {
            Weapons.Clear();
            HealthObjects.Clear();
            Idols.Clear();

            foreach (var gameItem in _inventory)
            {
                if (gameItem is Health)
                {
                    HealthObjects.Add(gameItem);
                }
                if (gameItem is Weapon)
                {
                    Weapons.Add(gameItem);
                }
                if (gameItem is Idol)
                {
                    Idols.Add(gameItem);
                }
            }
        }
コード例 #8
0
ファイル: OwnedIdolViewModel.cs プロジェクト: noelex/Cindeck
 public void OnActivate()
 {
     Idols.Refresh();
 }
コード例 #9
0
 public void OnActivate()
 {
     Idols.Refresh();
     TemporalUnit.Timestamp = DateTime.Now;
 }
コード例 #10
0
        public Character(IAccount account)
        {
            Account       = account;
            Stats         = new CharacterCharacteristicsInformations();
            Look          = new EntityLook();
            Restrictions  = new ActorRestrictionsInformations();
            Spells        = new List <SpellItem>();
            Status        = CharacterStatus.Disconnected;
            Jobs          = new List <JobExperience>();
            GatherManager = new GatherManager(Account);
            PathManager   = new PathManager(Account);

            Achievement = new Achievement(Account);
            Alliance    = new Alliance(Account);
            BidHouse    = new BidHouse(Account);
            Chat        = new Chat(Account);
            Map         = new Map(Account);
            Fight       = new Fight(Account);
            Friend      = new Friend(Account);
            Guild       = new Guild(Account);
            Inventory   = new Inventory(Account);
            Party       = new Party(Account);
            Idols       = new Idols(Account);

            #region Choice Handler

            account.Network.RegisterPacket <BasicCharactersListMessage>(HandleBasicCharactersListMessage,
                                                                        MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharactersListMessage>(HandleCharactersListMessage,
                                                                   MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterSelectedSuccessMessage>(HandleCharacterSelectedSuccessMessage,
                                                                             MessagePriority.VeryHigh);

            #endregion Choice Handler

            #region Creation Handler

            account.Network.RegisterPacket <CharacterCanBeCreatedResultMessage>(HandleCharacterCanBeCreatedResultMessage,
                                                                                MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterCreationResultMessage>(HandleCharacterCreationResultMessage,
                                                                            MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterNameSuggestionFailureMessage>(
                HandleCharacterNameSuggestionFailureMessage, MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterNameSuggestionSuccessMessage>(
                HandleCharacterNameSuggestionSuccessMessage, MessagePriority.VeryHigh);

            #endregion Creation Handler

            #region Deletion Handler

            account.Network.RegisterPacket <CharacterDeletionErrorMessage>(HandleCharacterDeletionErrorMessage,
                                                                           MessagePriority.VeryHigh);

            #endregion Deletion Handler

            #region Stats Handler

            account.Network.RegisterPacket <CharacterStatsListMessage>(HandleCharacterStatsListMessage,
                                                                       MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterExperienceGainMessage>(HandleCharacterExperienceGainMessage,
                                                                            MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterLevelUpInformationMessage>(HandleCharacterLevelUpInformationMessage,
                                                                                MessagePriority.VeryHigh);
            account.Network.RegisterPacket <CharacterLevelUpMessage>(HandleCharacterLevelUpMessage,
                                                                     MessagePriority.VeryHigh);
            account.Network.RegisterPacket <LifePointsRegenEndMessage>(HandleLifePointsRegenEndMessage,
                                                                       MessagePriority.VeryHigh);
            account.Network.RegisterPacket <UpdateLifePointsMessage>(HandleUpdateLifePointsMessage,
                                                                     MessagePriority.VeryHigh);

            #endregion Stats Handler

            #region Initialization Handler

            account.Network.RegisterPacket <CharacterLoadingCompleteMessage>(HandleCharacterLoadingCompleteMessage,
                                                                             MessagePriority.VeryHigh);
            account.Network.RegisterPacket <OnConnectionEventMessage>(HandleOnConnectionEventMessage,
                                                                      MessagePriority.VeryHigh);
            account.Network.RegisterPacket <SetCharacterRestrictionsMessage>(HandleSetCharacterRestrictionsMessage,
                                                                             MessagePriority.VeryHigh);

            #endregion Initialization Handler

            Account.Network.RegisterPacket <MapComplementaryInformationsDataMessage>(
                HandleMapComplementaryInformationsDataMessage, MessagePriority.Normal);
            Account.Network.RegisterPacket <GameContextRefreshEntityLookMessage>(
                HandleGameContextRefreshEntityLookMessage, MessagePriority.Normal);
        }