public void Add(TourUpdate tourUpdate) { // var category = _categoryRepo.All.Where(a => a.Id == tourUpdate.Category_Id).FirstOrDefault(); var categories = _categoryRepo.All.Where(a => tourUpdate.SelectedCategories.Contains(a.Id)); var tour = new Tour { Code = tourUpdate.Code, Name = tourUpdate.Name, Permalink = tourUpdate.Permalink, AvailabilityStatusId = tourUpdate.AvailabilityStatusId, TourTypeId = tourUpdate.TourTypeId, IsPublished = tourUpdate.IsPublished, LengthDescription = tourUpdate.LengthDescription, DepartureCity = tourUpdate.DepartureCity, ReturningCity = tourUpdate.ReturningCity, MailingListEmailName = tourUpdate.MailingListEmailName, MailingListUrl = tourUpdate.MailingListUrl, MailingListID = tourUpdate.MailingListID, SampleDocumentURL = tourUpdate.SampleDocumentURL }; SEOTool SEOTool = new Core.Domain.SEOTool(); SEOTool.FocusKeyword = tourUpdate.FocusKeyword; SEOTool.MetaDescription = tourUpdate.MetaDescription; SEOTool.SEOTitle = tourUpdate.SEOTitle; tour.SEOTools = new List<Core.Domain.SEOTool>(); tour.SEOTools.Add(SEOTool); tour.Categories = new System.Collections.Generic.List<Category>(); tour.Categories.AddRange(categories.ToList()); _tourRepo.Add(tour); }
public void Add(CategoryUpdate categoryUpdate) { var category = new Category { Code = categoryUpdate.Code, Description = categoryUpdate.Description, Name = categoryUpdate.Name, Permalink = categoryUpdate.Permalink, Published = categoryUpdate.Published, ListImageCaption = categoryUpdate.ListImageCaption, ListImageURL = categoryUpdate.ListImageURL, ListImageAltText = categoryUpdate.ListImageAltText, SliderImageURL = categoryUpdate.SliderImageURL, SliderImageAltText = categoryUpdate.SliderImageAltText, SliderImageCaption = categoryUpdate.SliderImageCaption }; SEOTool SEOTool = null; if (category.SEOTools != null && category.SEOTools.Count() > 0) SEOTool = category.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); category.SEOTools = new List<Core.Domain.SEOTool>(); category.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = categoryUpdate.FocusKeyword; SEOTool.MetaDescription = categoryUpdate.MetaDescription; SEOTool.SEOTitle = categoryUpdate.SEOTitle; _categoryRepo.Add(category); }
public void Add(TourUpdate tourUpdate) { // var category = _categoryRepo.All.Where(a => a.Id == tourUpdate.Category_Id).FirstOrDefault(); var categories = _categoryRepo.All.Where(a => tourUpdate.SelectedCategories.Contains(a.Id)); var tour = new Tour { Code = tourUpdate.Code, Name = tourUpdate.Name, Permalink = tourUpdate.Permalink, AvailabilityStatusId = tourUpdate.AvailabilityStatusId, TourTypeId = tourUpdate.TourTypeId, IsPublished = tourUpdate.IsPublished, LengthDescription = tourUpdate.LengthDescription, DepartureCity = tourUpdate.DepartureCity, ReturningCity = tourUpdate.ReturningCity, MailingListEmailName = tourUpdate.MailingListEmailName, MailingListUrl = tourUpdate.MailingListUrl, MailingListID = tourUpdate.MailingListID, SampleDocumentURL = tourUpdate.SampleDocumentURL }; SEOTool SEOTool = new Core.Domain.SEOTool(); SEOTool.FocusKeyword = tourUpdate.FocusKeyword; SEOTool.MetaDescription = tourUpdate.MetaDescription; SEOTool.SEOTitle = tourUpdate.SEOTitle; tour.SEOTools = new List <Core.Domain.SEOTool>(); tour.SEOTools.Add(SEOTool); tour.Categories = new System.Collections.Generic.List <Category>(); tour.Categories.AddRange(categories.ToList()); _tourRepo.Add(tour); }
public void Update(CategoryUpdate categoryUpdate) { var category = _categoryRepo.Find(categoryUpdate.Id); category.Code = categoryUpdate.Code; category.Description = categoryUpdate.Description; category.Name = categoryUpdate.Name; category.Permalink = categoryUpdate.Permalink; category.Published = categoryUpdate.Published; category.ListImageCaption = categoryUpdate.ListImageCaption; category.ListImageURL = categoryUpdate.ListImageURL; category.ListImageAltText = categoryUpdate.ListImageAltText; category.SliderImageURL = categoryUpdate.SliderImageURL; category.SliderImageAltText = categoryUpdate.SliderImageAltText; category.SliderImageCaption = categoryUpdate.SliderImageCaption; SEOTool SEOTool = null; if (category.SEOTools != null && category.SEOTools.Count() > 0) { SEOTool = category.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); category.SEOTools = new List <Core.Domain.SEOTool>(); category.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = categoryUpdate.FocusKeyword; SEOTool.MetaDescription = categoryUpdate.MetaDescription; SEOTool.SEOTitle = categoryUpdate.SEOTitle; _categoryRepo.Update(category); }
public void Update(TourUpdate tourUpdate) { var categories = _categoryRepo.All.Where(a => tourUpdate.SelectedCategories.Contains(a.Id)); var tour = _tourRepo.Find(tourUpdate.Id); tour.Code = tourUpdate.Code; tour.Name = tourUpdate.Name; tour.Permalink = tourUpdate.Permalink; tour.AvailabilityStatusId = tourUpdate.AvailabilityStatusId; tour.TourTypeId = tourUpdate.TourTypeId; tour.IsPublished = tourUpdate.IsPublished; tour.LengthDescription = tourUpdate.LengthDescription; tour.DepartureCity = tourUpdate.DepartureCity; tour.ReturningCity = tourUpdate.ReturningCity; tour.MailingListEmailName = tourUpdate.MailingListEmailName; tour.MailingListUrl = tourUpdate.MailingListUrl; tour.MailingListID = tourUpdate.MailingListID; tour.SampleDocumentURL = tourUpdate.SampleDocumentURL; SEOTool SEOTool = null; if (tour.SEOTools != null && tour.SEOTools.Count() > 0) { SEOTool = tour.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); tour.SEOTools = new List <Core.Domain.SEOTool>(); tour.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = tourUpdate.FocusKeyword; SEOTool.MetaDescription = tourUpdate.MetaDescription; SEOTool.SEOTitle = tourUpdate.SEOTitle; List <Category> exixtingCategories = tour.Categories.ToList(); foreach (Category c in exixtingCategories) { tour.Categories.Remove(c); } //tour.Categories = null; tour.Categories = new System.Collections.Generic.List <Category>(); tour.Categories.AddRange(categories.ToList()); _tourRepo.Update(tour); }
public void Update(PerspectivePostUpdate PerspectivePost) { // var perspectivePostsCategories = _categoryRepo.All.Where(a => PerspectivePost.SelectedCategories.Contains(a.Id)); var perspectivePost = _perspectiveRepo.Find(PerspectivePost.Id); perspectivePost.Headline = PerspectivePost.Headline; perspectivePost.BodyContent = PerspectivePost.BodyContent; perspectivePost.ThumbnailImageURL = PerspectivePost.ThumbnailImageURL; perspectivePost.ThumbnailImageAltText = PerspectivePost.ThumbnailImageAltText; perspectivePost.Image1URL = PerspectivePost.Image1URL; perspectivePost.Image1AltText = PerspectivePost.Image1AltText; perspectivePost.Image1Caption = PerspectivePost.Image1Caption; perspectivePost.Image2URL = PerspectivePost.Image2URL; perspectivePost.Image2AltText = PerspectivePost.Image2AltText; perspectivePost.Image2Caption = PerspectivePost.Image2Caption; perspectivePost.Image3URL = PerspectivePost.Image3URL; perspectivePost.Image3AltText = PerspectivePost.Image3AltText; perspectivePost.Image3Caption = PerspectivePost.Image3Caption; perspectivePost.Image4URL = PerspectivePost.Image4URL; perspectivePost.Image4AltText = PerspectivePost.Image4AltText; perspectivePost.Image4Caption = PerspectivePost.Image4Caption; perspectivePost.Permalink = PerspectivePost.Permalink; //perspectivePost.FocusKeyword = PerspectivePost.FocusKeyword; //perspectivePost.MetaDescription = PerspectivePost.MetaDescription; perspectivePost.IsPublished = PerspectivePost.IsPublished; //perspectivePost.SEOTitle = PerspectivePost.SEOTitle; perspectivePost.UpdatedAt = DateTime.Now; perspectivePost.TourId = PerspectivePost.TourId; SEOTool SEOTool = null; if (perspectivePost.SEOTools != null && perspectivePost.SEOTools.Count() > 0) { SEOTool = perspectivePost.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); perspectivePost.SEOTools = new List <Core.Domain.SEOTool>(); perspectivePost.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = PerspectivePost.FocusKeyword; SEOTool.MetaDescription = PerspectivePost.MetaDescription; SEOTool.SEOTitle = PerspectivePost.SEOTitle; _perspectiveRepo.Update(perspectivePost); }
public void Update(SubCategoryUpdate subcategoryUpdate) { var subcategory = _subcategoryRepo.Find(subcategoryUpdate.Id); subcategory.Code = subcategoryUpdate.Code; subcategory.Description = subcategoryUpdate.Description; subcategory.Name = subcategoryUpdate.Name; subcategory.Permalink = subcategoryUpdate.Permalink; subcategory.Published = subcategoryUpdate.Published; subcategory.ListImageCaption = subcategoryUpdate.ListImageCaption; subcategory.ListImageURL = subcategoryUpdate.ListImageURL; subcategory.ListImageAltText = subcategoryUpdate.ListImageAltText; subcategory.SliderImageURL = subcategoryUpdate.SliderImageURL; subcategory.SliderImageAltText = subcategoryUpdate.SliderImageAltText; subcategory.SliderImageCaption = subcategoryUpdate.SliderImageCaption; subcategory.CategoriesId = subcategoryUpdate.Category_Id; SEOTool SEOTool = null; if (subcategory.SEOTools != null && subcategory.SEOTools.Count() > 0) { SEOTool = subcategory.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); subcategory.SEOTools = new List <Core.Domain.SEOTool>(); subcategory.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = subcategoryUpdate.FocusKeyword; SEOTool.MetaDescription = subcategoryUpdate.MetaDescription; SEOTool.SEOTitle = subcategoryUpdate.SEOTitle; List <Tour> existingTours = subcategory.Tours.ToList(); foreach (Tour t in existingTours) { subcategory.Tours.Remove(t); } subcategory.Tours = new System.Collections.Generic.List <Tour>(); var tourss = _tourRepo.All.Where(a => subcategoryUpdate.SelectedTours.Contains(a.Id)); subcategory.Tours.AddRange(tourss); _subcategoryRepo.Update(subcategory); }
public void Add(PerspectivePostUpdate perspectivePostUpdate) { //var categories = _categoryRepo.All.Where(a => perspectivePostUpdate.SelectedCategories.Contains(a.Id)); var perspectivePost = new PerspectivePost { Headline = perspectivePostUpdate.Headline, BodyContent = perspectivePostUpdate.BodyContent, ThumbnailImageURL = perspectivePostUpdate.ThumbnailImageURL, ThumbnailImageAltText = perspectivePostUpdate.ThumbnailImageAltText, Image1URL = perspectivePostUpdate.Image1URL, Image1AltText = perspectivePostUpdate.Image1AltText, Image1Caption = perspectivePostUpdate.Image1Caption, Image2URL = perspectivePostUpdate.Image2URL, Image2AltText = perspectivePostUpdate.Image2AltText, Image2Caption = perspectivePostUpdate.Image2Caption, Image3URL = perspectivePostUpdate.Image3URL, Image3AltText = perspectivePostUpdate.Image3AltText, Image3Caption = perspectivePostUpdate.Image3Caption, Image4URL = perspectivePostUpdate.Image4URL, Image4AltText = perspectivePostUpdate.Image4AltText, Image4Caption = perspectivePostUpdate.Image4Caption, Permalink = perspectivePostUpdate.Permalink, //FocusKeyword = perspectivePostUpdate.FocusKeyword, //MetaDescription = perspectivePostUpdate.MetaDescription, IsPublished = perspectivePostUpdate.IsPublished, UserId = perspectivePostUpdate.UserId, //SEOTitle = perspectivePostUpdate.SEOTitle, TourId = perspectivePostUpdate.TourId, UpdatedAt = DateTime.Now, PostedOn = DateTime.Now }; SEOTool SEOTool = new Core.Domain.SEOTool(); SEOTool.FocusKeyword = perspectivePostUpdate.FocusKeyword; SEOTool.MetaDescription = perspectivePostUpdate.MetaDescription; SEOTool.SEOTitle = perspectivePostUpdate.SEOTitle; perspectivePost.SEOTools = new List <Core.Domain.SEOTool>(); perspectivePost.SEOTools.Add(SEOTool); _perspectiveRepo.Add(perspectivePost); }
public void Add(PerspectivePostUpdate perspectivePostUpdate) { //var categories = _categoryRepo.All.Where(a => perspectivePostUpdate.SelectedCategories.Contains(a.Id)); var perspectivePost = new PerspectivePost { Headline = perspectivePostUpdate.Headline, BodyContent = perspectivePostUpdate.BodyContent, ThumbnailImageURL = perspectivePostUpdate.ThumbnailImageURL, ThumbnailImageAltText = perspectivePostUpdate.ThumbnailImageAltText, Image1URL = perspectivePostUpdate.Image1URL, Image1AltText = perspectivePostUpdate.Image1AltText, Image1Caption = perspectivePostUpdate.Image1Caption, Image2URL = perspectivePostUpdate.Image2URL, Image2AltText = perspectivePostUpdate.Image2AltText, Image2Caption = perspectivePostUpdate.Image2Caption, Image3URL = perspectivePostUpdate.Image3URL, Image3AltText = perspectivePostUpdate.Image3AltText, Image3Caption = perspectivePostUpdate.Image3Caption, Image4URL = perspectivePostUpdate.Image4URL, Image4AltText = perspectivePostUpdate.Image4AltText, Image4Caption = perspectivePostUpdate.Image4Caption, Permalink = perspectivePostUpdate.Permalink, //FocusKeyword = perspectivePostUpdate.FocusKeyword, //MetaDescription = perspectivePostUpdate.MetaDescription, IsPublished = perspectivePostUpdate.IsPublished, UserId = perspectivePostUpdate.UserId, //SEOTitle = perspectivePostUpdate.SEOTitle, TourId = perspectivePostUpdate.TourId, UpdatedAt = DateTime.Now, PostedOn = DateTime.Now }; SEOTool SEOTool = new Core.Domain.SEOTool(); SEOTool.FocusKeyword = perspectivePostUpdate.FocusKeyword; SEOTool.MetaDescription = perspectivePostUpdate.MetaDescription; SEOTool.SEOTitle = perspectivePostUpdate.SEOTitle; perspectivePost.SEOTools = new List<Core.Domain.SEOTool>(); perspectivePost.SEOTools.Add(SEOTool); _perspectiveRepo.Add(perspectivePost); }
public void Add(GiftCardUpdate giftcardUpdate) { var giftcard = new GiftCard { GiftCode = giftcardUpdate.GiftCode, Name = giftcardUpdate.Name, GiftDescription = giftcardUpdate.GiftDescription, Price = giftcardUpdate.Price, BannerImageURL = giftcardUpdate.BannerImageURL, BannerImageAltText = giftcardUpdate.BannerImageAltText, ThumbnailImageURL = giftcardUpdate.ThumbnailImageURL, ThumbnailImageAltText = giftcardUpdate.ThumbnailImageAltText, ThumbnailCaption = giftcardUpdate.ThumbnailCaption, ThumbnailDescription = giftcardUpdate.ThumbnailDescription, Terms_Condition = giftcardUpdate.Terms_Condition, Permalink = giftcardUpdate.Permalink, IsPublished = giftcardUpdate.IsPublished, }; SEOTool SEOTool = null; if (giftcard.SEOTools != null && giftcard.SEOTools.Count() > 0) { SEOTool = giftcard.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); giftcard.SEOTools = new List <Core.Domain.SEOTool>(); giftcard.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = giftcardUpdate.FocusKeyword; SEOTool.MetaDescription = giftcardUpdate.MetaDescription; SEOTool.SEOTitle = giftcardUpdate.SEOTitle; _giftcardRepo.Add(giftcard); }
public void Add(SubCategoryUpdate subcategoryUpdate) { var subcategory = new SubCategory { Code = subcategoryUpdate.Code, Description = subcategoryUpdate.Description, Name = subcategoryUpdate.Name, Permalink = subcategoryUpdate.Permalink, Published = subcategoryUpdate.Published, ListImageCaption = subcategoryUpdate.ListImageCaption, ListImageURL = subcategoryUpdate.ListImageURL, ListImageAltText = subcategoryUpdate.ListImageAltText, SliderImageURL = subcategoryUpdate.SliderImageURL, SliderImageAltText = subcategoryUpdate.SliderImageAltText, SliderImageCaption = subcategoryUpdate.SliderImageCaption, CategoriesId = subcategoryUpdate.Category_Id }; SEOTool SEOTool = null; if (subcategory.SEOTools != null && subcategory.SEOTools.Count() > 0) { SEOTool = subcategory.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); subcategory.SEOTools = new List <Core.Domain.SEOTool>(); subcategory.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = subcategoryUpdate.FocusKeyword; SEOTool.MetaDescription = subcategoryUpdate.MetaDescription; SEOTool.SEOTitle = subcategoryUpdate.SEOTitle; var tours = _tourRepo.All.Where(a => subcategoryUpdate.SelectedTours.Contains(a.Id)); subcategory.Tours = new System.Collections.Generic.List <Tour>(); subcategory.Tours.AddRange(tours.ToList()); _subcategoryRepo.Add(subcategory); }
public void Add(SubCategoryUpdate subcategoryUpdate) { var subcategory = new SubCategory { Code = subcategoryUpdate.Code, Description = subcategoryUpdate.Description, Name = subcategoryUpdate.Name, Permalink = subcategoryUpdate.Permalink, Published = subcategoryUpdate.Published, ListImageCaption = subcategoryUpdate.ListImageCaption, ListImageURL = subcategoryUpdate.ListImageURL, ListImageAltText = subcategoryUpdate.ListImageAltText, SliderImageURL = subcategoryUpdate.SliderImageURL, SliderImageAltText = subcategoryUpdate.SliderImageAltText, SliderImageCaption = subcategoryUpdate.SliderImageCaption, CategoriesId=subcategoryUpdate.Category_Id }; SEOTool SEOTool = null; if (subcategory.SEOTools != null && subcategory.SEOTools.Count() > 0) SEOTool = subcategory.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); subcategory.SEOTools = new List<Core.Domain.SEOTool>(); subcategory.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = subcategoryUpdate.FocusKeyword; SEOTool.MetaDescription = subcategoryUpdate.MetaDescription; SEOTool.SEOTitle = subcategoryUpdate.SEOTitle; var tours = _tourRepo.All.Where(a => subcategoryUpdate.SelectedTours.Contains(a.Id)); subcategory.Tours = new System.Collections.Generic.List<Tour>(); subcategory.Tours.AddRange(tours.ToList()); _subcategoryRepo.Add(subcategory); }
public void Add(CategoryUpdate categoryUpdate) { var category = new Category { Code = categoryUpdate.Code, Description = categoryUpdate.Description, Name = categoryUpdate.Name, Permalink = categoryUpdate.Permalink, Published = categoryUpdate.Published, ListImageCaption = categoryUpdate.ListImageCaption, ListImageURL = categoryUpdate.ListImageURL, ListImageAltText = categoryUpdate.ListImageAltText, SliderImageURL = categoryUpdate.SliderImageURL, SliderImageAltText = categoryUpdate.SliderImageAltText, SliderImageCaption = categoryUpdate.SliderImageCaption }; SEOTool SEOTool = null; if (category.SEOTools != null && category.SEOTools.Count() > 0) { SEOTool = category.SEOTools.First(); } else { SEOTool = new Core.Domain.SEOTool(); category.SEOTools = new List <Core.Domain.SEOTool>(); category.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = categoryUpdate.FocusKeyword; SEOTool.MetaDescription = categoryUpdate.MetaDescription; SEOTool.SEOTitle = categoryUpdate.SEOTitle; _categoryRepo.Add(category); }
public void Add(GiftCardUpdate giftcardUpdate) { var giftcard = new GiftCard { GiftCode = giftcardUpdate.GiftCode, Name = giftcardUpdate.Name, GiftDescription = giftcardUpdate.GiftDescription, Price = giftcardUpdate.Price, BannerImageURL = giftcardUpdate.BannerImageURL, BannerImageAltText = giftcardUpdate.BannerImageAltText, ThumbnailImageURL = giftcardUpdate.ThumbnailImageURL, ThumbnailImageAltText = giftcardUpdate.ThumbnailImageAltText, ThumbnailCaption = giftcardUpdate.ThumbnailCaption, ThumbnailDescription = giftcardUpdate.ThumbnailDescription, Terms_Condition = giftcardUpdate.Terms_Condition, Permalink= giftcardUpdate.Permalink, IsPublished = giftcardUpdate.IsPublished, }; SEOTool SEOTool = null; if (giftcard.SEOTools != null && giftcard.SEOTools.Count() > 0) SEOTool = giftcard.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); giftcard.SEOTools = new List<Core.Domain.SEOTool>(); giftcard.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = giftcardUpdate.FocusKeyword; SEOTool.MetaDescription = giftcardUpdate.MetaDescription; SEOTool.SEOTitle = giftcardUpdate.SEOTitle; _giftcardRepo.Add(giftcard); }
public void Update(TourUpdate tourUpdate) { var categories = _categoryRepo.All.Where(a => tourUpdate.SelectedCategories.Contains(a.Id)); var tour = _tourRepo.Find(tourUpdate.Id); tour.Code = tourUpdate.Code; tour.Name = tourUpdate.Name; tour.Permalink = tourUpdate.Permalink; tour.AvailabilityStatusId = tourUpdate.AvailabilityStatusId; tour.TourTypeId = tourUpdate.TourTypeId; tour.IsPublished = tourUpdate.IsPublished; tour.LengthDescription = tourUpdate.LengthDescription; tour.DepartureCity = tourUpdate.DepartureCity; tour.ReturningCity = tourUpdate.ReturningCity; tour.MailingListEmailName = tourUpdate.MailingListEmailName; tour.MailingListUrl = tourUpdate.MailingListUrl; tour.MailingListID = tourUpdate.MailingListID; tour.SampleDocumentURL = tourUpdate.SampleDocumentURL; SEOTool SEOTool = null; if (tour.SEOTools != null && tour.SEOTools.Count() > 0) SEOTool = tour.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); tour.SEOTools = new List<Core.Domain.SEOTool>(); tour.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = tourUpdate.FocusKeyword; SEOTool.MetaDescription = tourUpdate.MetaDescription; SEOTool.SEOTitle = tourUpdate.SEOTitle; List<Category> exixtingCategories = tour.Categories.ToList(); foreach (Category c in exixtingCategories) tour.Categories.Remove(c); //tour.Categories = null; tour.Categories = new System.Collections.Generic.List<Category>(); tour.Categories.AddRange(categories.ToList()); _tourRepo.Update(tour); }
public void Update(SubCategoryUpdate subcategoryUpdate) { var subcategory = _subcategoryRepo.Find(subcategoryUpdate.Id); subcategory.Code = subcategoryUpdate.Code; subcategory.Description = subcategoryUpdate.Description; subcategory.Name = subcategoryUpdate.Name; subcategory.Permalink = subcategoryUpdate.Permalink; subcategory.Published = subcategoryUpdate.Published; subcategory.ListImageCaption = subcategoryUpdate.ListImageCaption; subcategory.ListImageURL = subcategoryUpdate.ListImageURL; subcategory.ListImageAltText = subcategoryUpdate.ListImageAltText; subcategory.SliderImageURL = subcategoryUpdate.SliderImageURL; subcategory.SliderImageAltText = subcategoryUpdate.SliderImageAltText; subcategory.SliderImageCaption = subcategoryUpdate.SliderImageCaption; subcategory.CategoriesId = subcategoryUpdate.Category_Id; SEOTool SEOTool = null; if (subcategory.SEOTools != null && subcategory.SEOTools.Count() > 0) SEOTool = subcategory.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); subcategory.SEOTools = new List<Core.Domain.SEOTool>(); subcategory.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = subcategoryUpdate.FocusKeyword; SEOTool.MetaDescription = subcategoryUpdate.MetaDescription; SEOTool.SEOTitle = subcategoryUpdate.SEOTitle; List<Tour> existingTours = subcategory.Tours.ToList(); foreach (Tour t in existingTours) subcategory.Tours.Remove(t); subcategory.Tours = new System.Collections.Generic.List<Tour>(); var tourss = _tourRepo.All.Where(a => subcategoryUpdate.SelectedTours.Contains(a.Id)); subcategory.Tours.AddRange(tourss); _subcategoryRepo.Update(subcategory); }
public void Update(CategoryUpdate categoryUpdate) { var category = _categoryRepo.Find(categoryUpdate.Id); category.Code = categoryUpdate.Code; category.Description = categoryUpdate.Description; category.Name = categoryUpdate.Name; category.Permalink = categoryUpdate.Permalink; category.Published = categoryUpdate.Published; category.ListImageCaption = categoryUpdate.ListImageCaption; category.ListImageURL = categoryUpdate.ListImageURL; category.ListImageAltText = categoryUpdate.ListImageAltText; category.SliderImageURL = categoryUpdate.SliderImageURL; category.SliderImageAltText = categoryUpdate.SliderImageAltText; category.SliderImageCaption = categoryUpdate.SliderImageCaption; SEOTool SEOTool = null; if (category.SEOTools != null && category.SEOTools.Count() > 0) SEOTool = category.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); category.SEOTools = new List<Core.Domain.SEOTool>(); category.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = categoryUpdate.FocusKeyword; SEOTool.MetaDescription = categoryUpdate.MetaDescription; SEOTool.SEOTitle = categoryUpdate.SEOTitle; _categoryRepo.Update(category); }
public void Update(PerspectivePostUpdate PerspectivePost) { // var perspectivePostsCategories = _categoryRepo.All.Where(a => PerspectivePost.SelectedCategories.Contains(a.Id)); var perspectivePost = _perspectiveRepo.Find(PerspectivePost.Id); perspectivePost.Headline = PerspectivePost.Headline; perspectivePost.BodyContent = PerspectivePost.BodyContent; perspectivePost.ThumbnailImageURL = PerspectivePost.ThumbnailImageURL; perspectivePost.ThumbnailImageAltText = PerspectivePost.ThumbnailImageAltText; perspectivePost.Image1URL = PerspectivePost.Image1URL; perspectivePost.Image1AltText = PerspectivePost.Image1AltText; perspectivePost.Image1Caption = PerspectivePost.Image1Caption; perspectivePost.Image2URL = PerspectivePost.Image2URL; perspectivePost.Image2AltText = PerspectivePost.Image2AltText; perspectivePost.Image2Caption = PerspectivePost.Image2Caption; perspectivePost.Image3URL = PerspectivePost.Image3URL; perspectivePost.Image3AltText = PerspectivePost.Image3AltText; perspectivePost.Image3Caption = PerspectivePost.Image3Caption; perspectivePost.Image4URL = PerspectivePost.Image4URL; perspectivePost.Image4AltText = PerspectivePost.Image4AltText; perspectivePost.Image4Caption = PerspectivePost.Image4Caption; perspectivePost.Permalink = PerspectivePost.Permalink; //perspectivePost.FocusKeyword = PerspectivePost.FocusKeyword; //perspectivePost.MetaDescription = PerspectivePost.MetaDescription; perspectivePost.IsPublished = PerspectivePost.IsPublished; //perspectivePost.SEOTitle = PerspectivePost.SEOTitle; perspectivePost.UpdatedAt = DateTime.Now; perspectivePost.TourId = PerspectivePost.TourId; SEOTool SEOTool = null; if (perspectivePost.SEOTools != null && perspectivePost.SEOTools.Count() > 0) SEOTool = perspectivePost.SEOTools.First(); else { SEOTool = new Core.Domain.SEOTool(); perspectivePost.SEOTools = new List<Core.Domain.SEOTool>(); perspectivePost.SEOTools.Add(SEOTool); } SEOTool.FocusKeyword = PerspectivePost.FocusKeyword; SEOTool.MetaDescription = PerspectivePost.MetaDescription; SEOTool.SEOTitle = PerspectivePost.SEOTitle; _perspectiveRepo.Update(perspectivePost); }