public void SetValues(PageCultureBinding Model) { this.PageID = Model.PageID; this.CultureID = Model.CultureID; this.FriendlyUrl = Model.FriendlyUrl == null ? "" : Model.FriendlyUrl; this.MetaDescription = Model.MetaDescription; this.Published = Model.Published; this.TitlePage = Model.TitlePage; this.ViewRender = Model.ViewRender; this.RedirectUrl = Model.RedirectUrl; this.Name = Model.Name; }
public IHttpActionResult SaveCulture(PageCultureBinding Model) { _PageService.SaveCulture(Model, User.Identity.GetUserId()); return Ok(); }
public PageCulture(PageCultureBinding Model) { SetValues(Model); }
public void SaveCulture(PageCultureBinding Model, string UserID) { using (var _c = db) { Can(Model.SiteID, UserID, _c); var _PageCulture = _c.PageCultures.Where(m => m.PageID == Model.PageID && m.CultureID == Model.CultureID).SingleOrDefault(); if (_PageCulture == null) { _PageCulture = new PageCulture(Model); _c.PageCultures.Add(_PageCulture); var _Page = _c.Pages.Where(m => m.PageID == Model.PageID).SingleOrDefault(); _Page.Alias = Model.PageAlias; } else { _PageCulture.SetValues(Model); _PageCulture.Page.Alias = Model.PageAlias; } //VERIFY FriendlyUrl is Unique if (_c.PageCultures.Where(m => (Model.FriendlyUrl != null ? m.FriendlyUrl.ToLower().Equals(Model.FriendlyUrl.ToLower()) : m.FriendlyUrl.Equals("")) && m.PageID != Model.PageID && m.Page.SiteID == Model.SiteID).Any()) throw new RuleException("Ya existe una seccion con el FriendlyUrl /" + Model.FriendlyUrl); _c.SaveChanges(); //SAVE OPEN GRAPH DATA var _OdataID = new OGraphBLL().SaveOGraph(Model.OGraph, Model.SiteID, UserID); if (_OdataID != 0) { var _OdataModel = _c.PageCulturesOGraphs.Where(m => m.PageID == Model.PageID && m.CultureID == Model.CultureID).FirstOrDefault(); if (_OdataModel != null) { _OdataModel.OGraphID = _OdataID; } else { _OdataModel = new PageCultureOGraph { CultureID = Model.CultureID, PageID = Model.PageID, OGraphID = _OdataID }; _c.PageCulturesOGraphs.Add(_OdataModel); } } _c.SaveChanges(); } }