Exemple #1
0
        public async Task SaveNewBonusRate(BonusRate bonusRate)
        {
            var data = await appDbContext.BonusRate.Where(x => x.BonusType.Equals(bonusRate.BonusType)).ToListAsync();

            if (data.Count > 0)
            {
                appDbContext.BonusRate.Remove(data.First());
            }

            appDbContext.BonusRate.Add(bonusRate);
            await appDbContext.SaveChangesAsync();
        }
 public static UpdateRateModelMasterRequest FromDict(JsonData data)
 {
     return(new UpdateRateModelMasterRequest {
         namespaceName = data.Keys.Contains("namespaceName") && data["namespaceName"] != null ? data["namespaceName"].ToString(): null,
         rateName = data.Keys.Contains("rateName") && data["rateName"] != null ? data["rateName"].ToString(): null,
         description = data.Keys.Contains("description") && data["description"] != null ? data["description"].ToString(): null,
         metadata = data.Keys.Contains("metadata") && data["metadata"] != null ? data["metadata"].ToString(): null,
         targetInventoryModelId = data.Keys.Contains("targetInventoryModelId") && data["targetInventoryModelId"] != null ? data["targetInventoryModelId"].ToString(): null,
         acquireExperienceSuffix = data.Keys.Contains("acquireExperienceSuffix") && data["acquireExperienceSuffix"] != null ? data["acquireExperienceSuffix"].ToString(): null,
         materialInventoryModelId = data.Keys.Contains("materialInventoryModelId") && data["materialInventoryModelId"] != null ? data["materialInventoryModelId"].ToString(): null,
         acquireExperienceHierarchy = data.Keys.Contains("acquireExperienceHierarchy") && data["acquireExperienceHierarchy"] != null ? data["acquireExperienceHierarchy"].Cast <JsonData>().Select(value =>
         {
             return value.ToString();
         }
                                                                                                                                                                                                   ).ToList() : null,
         experienceModelId = data.Keys.Contains("experienceModelId") && data["experienceModelId"] != null ? data["experienceModelId"].ToString(): null,
         bonusRates = data.Keys.Contains("bonusRates") && data["bonusRates"] != null ? data["bonusRates"].Cast <JsonData>().Select(value =>
         {
             return BonusRate.FromDict(value);
         }
                                                                                                                                   ).ToList() : null,
     });
 }