public void Add(ProductGroupRelatedProductGroupsModel model)
 {
     _doc.Root.Add(new XElement("Relation",
                                new XElement("ProductGroup", model.ProductGroup),
                                new XElement("RelatedProductGroups", model.RelatedProductGroups)
                                ));
 }
Example #2
0
 public ActionResult Delete(ProductGroupRelatedProductGroupsModel model, string _ProductGroup)
 {
     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 ProductGroupRelatedProductGroupsRepository(document);
             model.ProductGroup = _ProductGroup;
             repo.Delete(model);
             setting.Value = document.ToString();
             unit.Save();
             return(Success("Successfully deleted relation"));
         }
         catch (Exception e)
         {
             return(Failure("Something went wrong: ", e));
         }
     }
 }
        public void Delete(ProductGroupRelatedProductGroupsModel model)
        {
            var xmlEntry = _doc.Root.Elements("Relation").Where(c => c.Element("ProductGroup").Value == model.ProductGroup).FirstOrDefault();

            xmlEntry.Remove();
        }