Ejemplo n.º 1
0
        public ActionResult Overview(ProductGalleryVM obj)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    // TODO: Add insert logic here
                    obj = ExcuteActionCommonView(obj);
                    obj.SectionGalleries.PositionGalleryID = _repoPosition.GetItemByPosName(PositionTab.Overview).PositionGalleryID;
                    obj.SectionContents.PositionGalleryID  = obj.SectionGalleries.PositionGalleryID;
                    obj.ListSectionGalleries.Add(obj.SectionGalleries);

                    if (obj.CollectUrlGallery != null && obj.CollectUrlGallery.Any())
                    {
                        obj.ListSectionGalleries.Add(new Fly_SectionGallery()
                        {
                            CollectionImage = obj.CollectUrlGallery.Substring(0,
                                                                              obj.CollectUrlGallery.Length - 1),
                            CreatedOn         = DateTime.Now,
                            PositionGalleryID = _repoPosition.GetItemByPosName(PositionTab.Gallery).PositionGalleryID,
                            ProductID         = obj.SectionContents.ProductID
                        });
                    }


                    _repoSectionContent.Add(obj.SectionContents);
                    foreach (var listSectionGallery in obj.ListSectionGalleries)
                    {
                        _repoSectionGallery.Add(listSectionGallery);
                    }

                    scope.Complete();
                    scope.Dispose();
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }
Ejemplo n.º 2
0
 public ActionResult Create(ProductGalleryVM obj)
 {
     try
     {
         // TODO: Add insert logic here
         obj.SectionContents.CreatedOn         = DateTime.Now;
         obj.SectionContents.UpdateOn          = DateTime.Now;
         obj.SectionContents.PositionGalleryID = obj.PositionGalleries.PositionGalleryID;
         _repository.Add(obj.SectionContents);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         return(View(e.Message));
     }
 }