示例#1
0
        public ActionResult Edit(NavigationVm obj)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    _vm.Navigation           = obj.Navigation;
                    _vm.Navigation.Published = obj.Publish;
                    _vm.Navigation.Deleted   = obj.Deleted;
                    _vm.Navigation.CreatedOn = DateTime.Now;
                    if (obj.SubProducts != null && obj.SubProducts.Any())
                    {
                        _vm.Navigation.parentid = 3;
                    }
                    _repositryBase.Edit(_vm.Navigation);

                    scope.Complete();
                    scope.Dispose();
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }
示例#2
0
 public ActionResult Edit(Fly_BannerType bannertype)
 {
     try
     {
         repository.Edit(bannertype);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#3
0
 public ActionResult Edit(DiscountVm obj)
 {
     try
     {
         obj.FlyDiscount.Deleted = obj.Deleted;
         obj.FlyDiscount.EndDate = DateTime.Now;
         _repositryBase.Edit(obj.FlyDiscount);
         return(RedirectToAction("Index"));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
 public ActionResult Edit(BannerModel obj)
 {
     try
     {
         obj.banner.Published = obj.isPublish;
         obj.banner.Deleted = obj.isDelete;
         _repository.Edit(obj.banner);
         return RedirectToAction("Index");
     }
     catch(Exception e)
     {
         return View(e.Message);
     }
 }
示例#5
0
 public ActionResult Edit(TeamVm obj)
 {
     try
     {
         obj.Team.Published = obj.IsPublish;
         obj.Team.Deleted   = obj.IsDelete;
         _repository.Edit(obj.Team);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
示例#6
0
 public ActionResult Edit(PartnershipVM obj)
 {
     try
     {
         // edit record
         obj.Partnership.Deleted   = obj.isDelete;
         obj.Partnership.Published = obj.isPublish;
         repository.Edit(obj.Partnership);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#7
0
        public ActionResult Edit(CategoriesVM obj)
        {
            try
            {
                //// save record Categories
                //obj.Categories.Published = obj.isPublish;
                //obj.Categories.Deleted = obj.isDelete;
                //obj.Categories.ShowOnHomePage = obj.isHome;
                //repository.Edit(obj.Categories);

                ////save record CategoriesLocalized
                //obj.CategoriesLocalized.CategoryID = obj.Categories.CategoryID;
                //repositoryLocalized.Edit(obj.CategoriesLocalized);

                ////save record Categories Mapping Discount
                //obj.CategoryDiscountMapping.CategoryID = obj.Categories.CategoryID;
                //obj.CategoryDiscountMapping.DiscountID = obj.SelectValues;
                //repositoryMapping.Edit(obj.CategoryDiscountMapping);


                /**/
                // save record Categories
                obj.Categories.Published      = obj.isPublish;
                obj.Categories.Deleted        = obj.isDelete;
                obj.Categories.UpdatedOn      = DateTime.Now;
                obj.Categories.ShowOnHomePage = obj.isHome;

                //save record CategoriesLocalized
                obj.Categories.Fly_CategoryLocalized.Add(obj.CategoriesLocalized);


                //save record Categories Mapping Discount
                obj.CategoryDiscountMapping.DiscountID = obj.SelectValues;
                obj.Categories.Fly_Category_Discount_Mapping.Add(obj.CategoryDiscountMapping);

                // save
                repository.Edit(obj.Categories);
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }
示例#8
0
 public ActionResult Edit(int id, BlogPostVm obj)
 {
     try
     {
         // TODO: Add update logic here
         if (obj.IsVideo == 1)
         {
             obj.Blogpost.VideoLink = "";
         }
         obj.Blogpost.Published = obj.IsPublish;
         obj.Blogpost.CreatedOn = DateTime.Now;
         _repos.Edit(obj.Blogpost);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
示例#9
0
        public ActionResult Edit(ManufacturerVM obj)
        {
            try
            {
                // save Manufacturer
                obj.Manufacturer.Published = obj.isPubish;
                obj.Manufacturer.Deleted   = obj.isDelete;
                obj.Manufacturer.UpdatedOn = DateTime.Now;

                // save ManufacturerLocalized
                obj.ManufacturerLocalized.ManufacturerID = obj.Manufacturer.ManufacturerID;
                obj.Manufacturer.Fly_ManufacturerLocalized.Add(obj.ManufacturerLocalized);

                repository.Edit(obj.Manufacturer);


                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }
示例#10
0
        public ActionResult Edit(ProductVM obj)
        {
            try
            {
                // get product table


                //save product table
                obj.Product.Published      = obj.isPublish;
                obj.Product.Deleted        = obj.isDelete;
                obj.Product.isAccessories  = obj.isAccessories;
                obj.Product.ShowOnHomePage = obj.isHome;

                // save productvariant table
                obj.ProductVariant.IsShipEnabled  = obj.isShipEnabled;
                obj.ProductVariant.IsFreeShipping = obj.isFreeShipping;
                obj.ProductVariant.CallForPrice   = obj.isCallForPrice;
                obj.ProductVariant.isHot          = obj.isHot;
                obj.ProductVariant.isNew          = obj.isNew;
                obj.ProductVariant.isGift         = obj.isGift;
                obj.ProductVariant.Fly_ProductVariant_Discount_Mapping.Add(new Fly_ProductVariant_Discount_Mapping {
                    DiscountID = obj.indexDiscount, DiscountMappingID = obj.MappingDiscount.DiscountMappingID, ProductVariantID = obj.ProductVariant.ProductVariantId
                });
                obj.Product.Fly_ProductVariant.Add(obj.ProductVariant);


                obj.Product.Fly_ProductLocalized.Add(obj.ProductLocalized);
                obj.Product.Fly_ProductPicture.Add(obj.ProductPictures);

                obj.Product.Fly_Product_Category_Mapping.Add(new Fly_Product_Category_Mapping {
                    CategoryID = obj.indexCate, ProductCategoryID = obj.MappingCategories.ProductCategoryID
                });
                obj.Product.Fly_Product_Manufacturer_Mapping.Add(new Fly_Product_Manufacturer_Mapping {
                    ManufacturerID = obj.indexManufacturer, ProductManufacturerID = obj.MappingManufacturer.ProductManufacturerID
                });



                repository.Edit(obj.Product);

                if (obj.arrRelationProduct != null)
                {
                    for (int i = 0; i < obj.arrRelationProduct.Split(',').Length; i++)
                    {
                        if (obj.arrRelationId != null && (obj.arrRelationId.Split(',')[i]) != null)
                        {
                            _repoRelatedProduct.Edit(new Fly_RelatedProduct()
                            {
                                ProductID1       = obj.Product.ProductId,
                                ProductID2       = int.Parse(obj.arrRelationProduct.Split(',')[i]),
                                RelatedProductID = int.Parse(obj.arrRelationId.Split(',')[i])
                            });
                        }
                    }
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }
示例#11
0
        public ActionResult Edit(ProductVM obj)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    // get product table


                    //save product table
                    obj.Product.Published      = obj.isPublish;
                    obj.Product.Deleted        = obj.isDelete;
                    obj.Product.isAccessories  = obj.isAccessories;
                    obj.Product.UpdatedOn      = DateTime.Now;
                    obj.Product.ShowOnHomePage = obj.isHome;

                    // save productvariant table
                    obj.ProductVariant.IsShipEnabled  = obj.isShipEnabled;
                    obj.ProductVariant.IsFreeShipping = obj.isFreeShipping;
                    obj.ProductVariant.UpdatedOn      = DateTime.Now;
                    obj.ProductVariant.CallForPrice   = obj.isCallForPrice;
                    obj.ProductVariant.Deleted        = obj.Product.Deleted;
                    obj.ProductVariant.Name           = obj.Product.Name;
                    obj.ProductVariant.Description    = obj.Product.FullDescription;
                    obj.ProductVariant.Published      = obj.Product.Published;
                    obj.ProductVariant.isHot          = obj.isHot;
                    obj.ProductVariant.isNew          = obj.isNew;
                    obj.ProductVariant.isGift         = obj.isGift;

                    if (obj.indexDiscount > 0)
                    {
                        obj.ProductVariant.Fly_ProductVariant_Discount_Mapping.Add(new Fly_ProductVariant_Discount_Mapping
                        {
                            DiscountID        = obj.indexDiscount,
                            DiscountMappingID = obj.MappingDiscount.DiscountMappingID,
                            ProductVariantID  = obj.ProductVariant.ProductVariantId
                        });
                    }
                    obj.Product.Fly_ProductVariant.Add(obj.ProductVariant);
                    obj.Product.Fly_ProductLocalized.Add(obj.ProductLocalized);
                    obj.Product.Fly_ProductPicture.Add(obj.ProductPictures);

                    if (obj.indexCate > 0)
                    {
                        obj.Product.Fly_Product_Category_Mapping.Add(new Fly_Product_Category_Mapping
                        {
                            CategoryID        = obj.indexCate,
                            ProductCategoryID = obj.MappingCategories.ProductCategoryID
                        });
                    }

                    if (obj.indexManufacturer > 0)
                    {
                        obj.Product.Fly_Product_Manufacturer_Mapping.Add(new Fly_Product_Manufacturer_Mapping
                        {
                            ManufacturerID        = obj.indexManufacturer,
                            ProductManufacturerID = obj.MappingManufacturer.ProductManufacturerID
                        });
                    }

                    if (!obj.isNullData)
                    {
                        obj.SectionGalleries.PositionGalleryID = 5; // gallery
                        obj.SectionGalleries.CollectionImage   = obj.SectionGalleries.CollectionImage.Substring(0,
                                                                                                                obj.SectionGalleries.CollectionImage.Length - 1);
                        obj.SectionGalleries.CreatedOn = DateTime.Now;
                        obj.SectionGalleries.ProductID = obj.Product.ProductId;
                        _repoSectionGallery.Add(obj.SectionGalleries);
                    }

                    _repository.Edit(obj.Product);

                    if (obj.arrRelationProduct != null)
                    {
                        for (int i = 0; i < obj.arrRelationProduct.Split(',').Length; i++)
                        {
                            if (obj.arrRelationId != null && (obj.arrRelationId.Split(',')[i]) != null)
                            {
                                _repoRelatedProduct.Edit(new Fly_RelatedProduct()
                                {
                                    ProductID1       = obj.Product.ProductId,
                                    ProductID2       = int.Parse(obj.arrRelationProduct.Split(',')[i]),
                                    RelatedProductID = int.Parse(obj.arrRelationId.Split(',')[i])
                                });
                            }
                        }
                    }

                    scope.Complete();
                    scope.Dispose();
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e));
            }
        }