예제 #1
0
        /// <summary>
        /// Updates the current Clan
        /// </summary>
        public static void Update(Clan clan)
        {
            using (var dbContext = new HouseOfClansEntities())
            {
                Clan clanInfo = ClanManager.SelectByClanId(clan.id);
                clanInfo.updatedOn = DateTime.Now;

                dbContext.Clans.Attach(clanInfo);
                dbContext.Entry(clanInfo).CurrentValues.SetValues(clan);
                dbContext.SaveChanges();
            }
        }
예제 #2
0
        /// <summary>
        /// Deletes the current Clan
        /// </summary>
        public static bool Delete(int clanId)
        {
            bool isDeleted  = false;
            Clan deleteClan = ClanManager.SelectByClanId(clanId);

            using (var dbContext = new HouseOfClansEntities())
            {
                dbContext.Clans.Attach(deleteClan);
                dbContext.Clans.Remove(deleteClan);
                isDeleted = dbContext.SaveChanges() > 0;
            }

            return(isDeleted);
        }