コード例 #1
0
 public void Add(ImportSeasonCodeRuleModel model)
 {
     doc.Root.Add(new XElement("Rule",
                               new XElement("Season", model.SeasonCode),
                               new XElement("ProductGroups", model.ProductGroupCodes)
                               ));
 }
コード例 #2
0
 public ActionResult Delete(ImportSeasonCodeRuleModel model, string _SeasonCode)
 {
     using (var unit = GetUnitOfWork())
     {
         try
         {
             var setting  = unit.Service <VendorSetting>().Get(c => c.VendorID == _vendorID && c.SettingKey == _settingKey);
             var document = XDocument.Parse(setting.Value);
             var repo     = new ImportSeasonCodeRuleRepository(document);
             model.SeasonCode = _SeasonCode;
             repo.Delete(model);
             setting.Value = document.ToString();
             unit.Save();
             return(Success("Successfully deleted rule"));
         }
         catch (Exception e)
         {
             return(Failure("Something went wrong: ", e));
         }
     }
 }
コード例 #3
0
        internal void Delete(ImportSeasonCodeRuleModel model)
        {
            var xmlEntry = doc.Root.Elements("Rule").Where(c => c.Element("Season").Value == model.SeasonCode).FirstOrDefault();

            xmlEntry.Remove();
        }
コード例 #4
0
        public void Update(ImportSeasonCodeRuleModel model)
        {
            var xmlEntry = doc.Root.Elements("Rule").Where(c => c.Element("Season").Value == model.SeasonCode).FirstOrDefault();

            xmlEntry.Element("ProductGroups").Value = model.ProductGroupCodes;
        }