示例#1
0
        public ActionResult GetAll()
        {
            using (var unit = GetUnitOfWork())
            {
                var document = XDocument.Parse(unit.Service <VendorSetting>().Get(c => c.VendorID == _vendorID && c.SettingKey == _settingKey).Value);
                var repo     = new ImportSeasonCodeRuleRepository(document);

                var results = repo.GetAllRules().AsQueryable();

                return(List(results.AsQueryable()));
            }
        }
示例#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));
         }
     }
 }