public static RewardInfoLang UpdateRewardInfoLang(int id, RewardInfoLang val)
        {
            try
            {
                RewardInfoLang c0 = dataContext.RewardInfoLangs.Where(x => x.Id == id).SingleOrDefault();
                if (val.Id != null)
                {
                    c0.Id = val.Id;
                }
                if (val.title != null)
                {
                    c0.title = val.title;
                }
                if (val.description != null)
                {
                    c0.description = val.description;
                }

                dataContext.SaveChanges();
                return(GetRewardInfoLang(id));
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public static void DeleteRewardInfoLang(int id)
        {
            RewardInfoLang c = dataContext.RewardInfoLangs.Where(x => x.Id == id).SingleOrDefault();

            if (c != null)
            {
                dataContext.RewardInfoLangs.Remove(c);
                dataContext.SaveChanges();
            }
        }
Beispiel #3
0
        public static List <RewardInfoLang> UpdateInfoRewardFromList(List <RewardInfoLang> infoRewards)
        {
            foreach (var info in infoRewards)
            {
                RewardInfoLang c0 = dataContext.RewardInfoLangs.Where(x => x.Id == info.Id).SingleOrDefault();
                if (!info.title.Equals(""))
                {
                    c0.title = info.title;
                }
            }

            return(infoRewards);
        }
 public static RewardInfoLang InsertRewardInfoLang(RewardInfoLang val)
 {
     try
     {
         dataContext.RewardInfoLangs.Add(val);
         dataContext.SaveChanges();
         return(GetRewardInfoLang(val.Id));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
        public static RewardInfoLang GetRewardInfoLang(int rewardInfoID)
        {
            RewardInfoLang c = dataContext.RewardInfoLangs.Where(x => x.Id == rewardInfoID).SingleOrDefault();

            return(c);
        }