Пример #1
0
        public static async Task <Models.AdvertisementReward> Add(long member_no, Models.AdvertisementReward entity)
        {
            using (var context = new Lobby.Models.GameContext(member_no))
            {
                context.advertisement_reward.Add(entity);
                await context.SaveChangesAsync();

                return(entity);
            }
        }
Пример #2
0
        public static async Task <bool> Update(long member_no, Models.AdvertisementReward entity)
        {
            try
            {
                using (var context = new Lobby.Models.GameContext(member_no))
                {
                    var row = await context.advertisement_reward.Where(x => x.advertisement_no == entity.advertisement_no).FirstOrDefaultAsync();

                    if (row != null && row != default(Models.AdvertisementReward))
                    {
                        row.Copy(entity);
                        await context.SaveChangesAsync();

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error($"{e.ToString()}");
                return(false);
            }
            return(true);
        }
Пример #3
0
 public void Copy(AdvertisementReward other)
 {
     advertisement_id = other.advertisement_id;
     reward           = other.reward;
     occ_time         = other.occ_time;
 }