public ActionResult Edit(int id) { //todo: add later //if (!_permissionService.Authorize(MobSocialPermissionProvider.ManageEventPages)) // return AccessDeniedView(); var item = _eventPageService.GetById(id); if (item == null) //Not found { return(RedirectToAction("List")); } var model = new EventPageModel() { Id = item.Id, Name = item.Name, SeName = SeoExtensions.GetSeName(item, _workContext.WorkingLanguage.Id), LocationName = item.LocationName, Address1 = item.LocationAddress1, Address2 = item.LocationAddress2, City = item.LocationCity, LocationState = item.LocationState, ZipPostalCode = item.LocationZipPostalCode, LocationCountry = item.LocationCountry, Phone = item.LocationPhone, Website = item.LocationWebsite, Email = item.LocationEmail, StartDate = item.StartDate, EndDate = item.EndDate, Description = item.Description, DateCreated = item.DateCreated, DateUpdated = item.DateUpdated, MetaDescription = item.MetaDescription, MetaKeywords = item.MetaKeywords, }; return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/Admin/ManageEventPage/Edit.cshtml", model)); }
public ActionResult Index(int?id, int?page) { if (!_customerSettings.AllowViewingProfiles) { return(RedirectToRoute("HomePage")); } var entityId = 0; if (id.HasValue) { entityId = id.Value; } var entity = _eventPageService.GetById(entityId); if (entity == null) { return(RedirectToRoute("HomePage")); } var model = new EventPageModel() { Id = entity.Id, Name = entity.Name, LocationName = entity.LocationName, LocationAddress1 = entity.LocationAddress1, LocationAddress2 = entity.LocationAddress2, LocationCity = entity.LocationCity, LocationState = entity.LocationState, ZipPostalCode = entity.LocationZipPostalCode, LocationCountry = entity.LocationCountry, Phone = entity.LocationPhone, Email = entity.LocationEmail, Website = entity.LocationWebsite, StartDate = entity.StartDate, EndDate = entity.EndDate, Description = entity.Description, MetaKeywords = entity.MetaKeywords, MetaDescription = entity.MetaDescription, DateCreated = entity.DateCreated, DateUpdated = entity.DateUpdated, }; // Event Page Hotels foreach (var hotel in entity.Hotels) { model.Hotels.Add(new EventPageHotelModel { Id = hotel.Id, Name = hotel.Name, Title = hotel.Title, Address1 = hotel.Address1, Address2 = hotel.Address2, City = hotel.City, State = hotel.State, ZipPostalCode = hotel.ZipPostalCode, Country = hotel.Country, PhoneNumber = hotel.PhoneNumber, AdditionalInformation = hotel.AdditionalInformation }); } // Event Page Pictures foreach (var picture in entity.Pictures) { model.Pictures.Add(new PictureModel { Id = picture.Id, EntityId = entity.Id, PictureId = picture.PictureId, DisplayOrder = picture.DisplayOrder, DateCreated = picture.DateCreated, DateUpdated = picture.DateUpdated, PictureUrl = _pictureService.GetPictureUrl(picture.PictureId, 200), }); } if (entity.Pictures.Count > 0) { model.MainPictureUrl = model.Pictures.First().PictureUrl; model.FullSizeImageUrl = _pictureService.GetPictureUrl(model.Pictures.First().PictureId); } else { model.MainPictureUrl = _pictureService.GetDefaultPictureUrl(200); model.FullSizeImageUrl = _pictureService.GetDefaultPictureUrl(); } return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/EventPage/Index.cshtml", model)); }