Example #1
0
        public ActionResult AddOrUpdate(int id = 0)
        {
            var model = _homeEntityRepository.Get(id);

            if (model == null)
            {
                model = new Entity.HomeEntity();
            }
            ViewBag.CategoriesSelectListItem = _categoryRepository.GetAll().Select(item => new SelectListItem
            {
                Text  = item.Title,
                Value = item.Id.ToString()
            });
            ViewBag.FaqSelectListItem = _faqRepository.GetAll().Select(item => new SelectListItem
            {
                Text  = item.Title,
                Value = item.Id.ToString()
            });
            return(View(model));
        }
Example #2
0
 public ActionResult AddOrUpdate(Entity.HomeEntity model)
 {
     _homeEntityRepository.AddOrUpdate(model);
     return(RedirectToAction("Index"));
 }
Example #3
0
        public ActionResult PartialAllPoints(int id, bool isview)
        {
            //var config = new MapperConfiguration(cfg =>
            //{
            //    cfg.CreateMap<DBFirstDAL.DataModels.HomeModels.HomeEntityModel, Pyramid.Entity.HomeEntity>()
            //     .ForMember(d => d.Categories, o => o.Ignore())
            //      .ForMember(d => d.Faq, o => o.Ignore());

            //    cfg.CreateMap<DBFirstDAL.HomeEntity, Pyramid.Entity.HomeEntity>()
            //    .ForMember(d => d.Categories, o => o.Ignore())
            //     .ForMember(d => d.Faq, o => o.Ignore())
            //     .ForMember(d => d.Products, o => o.Ignore());

            //    cfg.CreateMap<DBFirstDAL.BannerWithPoints, Pyramid.Entity.BannerWithPoints>();

            //    cfg.CreateMap<DBFirstDAL.PointOnImgs, Pyramid.Entity.PointOnImg>();

            //    //cfg.CreateMap<List<DBFirstDAL.PointOnImgs>, List<Pyramid.Entity.PointOnImg>>();

            //    cfg.CreateMap<DBFirstDAL.Products, Pyramid.Entity.Product>()
            //     .ForMember(d => d.EnumValues, o => o.Ignore())
            //      .ForMember(d => d.Categories, o => o.Ignore())
            //       .ForMember(d => d.Images, o => o.Ignore())
            //        .ForMember(d => d.ProductValues, o => o.Ignore())
            //         .ForMember(d => d.ThumbnailId, o => o.Ignore())
            //            .ForMember(d => d.ThumbnailImg, o => o.Ignore());



            //    cfg.CreateMap<DBFirstDAL.DataModels.HomeModels.ProductHomeModel, Entity.Product>()
            //    .ForMember(d => d.Categories, o => o.Ignore())
            //    .ForMember(d => d.EnumValues, o => o.Ignore())
            //    .ForMember(d => d.ProductValues, o => o.Ignore())
            //    .ForMember(d => d.ThumbnailId, o => o.Ignore())
            //    .ForMember(d => d.MetaDescription, o => o.Ignore())
            //    .ForMember(d => d.MetaKeywords, o => o.Ignore())
            //    .ForMember(d => d.MetaTitle, o => o.Ignore())
            //    .ForMember(d => d.Images, o => o.Ignore())
            //    .ForMember(d => d.IsSEOReady, o => o.Ignore())
            //    .ForMember(d => d.Alias, o => o.Ignore())
            //    .ForMember(d => d.DateCreation, o => o.Ignore())
            //    .ForMember(d => d.DateChange, o => o.Ignore())
            //    ;

            //    cfg.CreateMap<DBFirstDAL.Images, Entity.Image>()
            //  ;
            //});


            //config.AssertConfigurationIsValid();

            //var mapper = config.CreateMapper();



            //var efModel = _homeEntityRepository.GetModel(id);

            Entity.HomeEntity model = _homeEntityRepository.Get(id);
            if (model == null)
            {
                model = new Entity.HomeEntity();
            }

            ViewBag.CategoriesSelectListItem = _categoryRepository.GetAll().Select(item => new SelectListItem
            {
                Text  = item.Title,
                Value = item.Id.ToString()
            });


            if (model.BannerWithPoints != null && model.BannerWithPoints.PointOnImgs != null)
            {
                if (isview)
                {
                    return(PartialView("_PartialAllPointOnImg", model.BannerWithPoints.PointOnImgs));
                }
                else
                {
                    return(PartialView("_PartialAllPoints", model.BannerWithPoints.PointOnImgs));
                }
            }
            return(PartialView("_PartialAllPoints", new List <Pyramid.Entity.PointOnImg>()));
        }