public ActionResult Create(CategoriesVM obj) { try { // save record Categories obj.Categories.Published = obj.isPublish; obj.Categories.Deleted = obj.isDelete; obj.Categories.ShowOnHomePage = obj.isHome; obj.Categories.CreatedOn = DateTime.Now; //save record CategoriesLocalized obj.Categories.Fly_CategoryLocalized.Add(obj.CategoriesLocalized); //save record Categories Mapping Discount obj.CategoryDiscountMapping.DiscountID = obj.SelectValues; obj.CategoryDiscountMapping.Createdon = DateTime.Now; obj.Categories.Fly_Category_Discount_Mapping.Add(obj.CategoryDiscountMapping); // save repository.Add(obj.Categories); return(RedirectToAction("Index")); } catch (Exception e) { return(View(e.Message)); } }
public ActionResult Create(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.Add(_vm.Navigation); scope.Complete(); scope.Dispose(); } return(RedirectToAction("Index")); } catch (Exception e) { return(View(e.Message)); } }
public ActionResult Create(FlyEntity.Fly_BannerType bannertype) { try { // TODO: Add insert logic here repository.Add(bannertype); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(DiscountVm obj) { try { obj.FlyDiscount.Deleted = obj.Deleted; obj.FlyDiscount.StartDate = DateTime.Now; obj.FlyDiscount.EndDate = DateTime.Now; _repositryBase.Add(obj.FlyDiscount); return(RedirectToAction("Index")); } catch (Exception) { throw; } }
public ActionResult Create(TeamVm obj) { try { obj.Team.LanguageId = 1; // language vietnamese obj.Team.CreatedOn = DateTime.Now; obj.Team.Deleted = false; obj.Team.Published = obj.IsPublish; obj.Team.Deleted = obj.IsDelete; _repository.Add(obj.Team); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(ex.Message)); } }
public ActionResult Create(PartnershipVM obj) { try { // save data obj.Partnership.Deleted = obj.isDelete; obj.Partnership.Published = obj.isPublish; obj.Partnership.CreatedOn = DateTime.Now; if (Session["idxu"] != null && Session["idxu"].ToString().Length > 0) { obj.Partnership.CreatedByID = int.Parse(Session["idxu"].ToString()); } repository.Add(obj.Partnership); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(ManufacturerVM obj) { try { // save Manufacturer obj.Manufacturer.Published = obj.isPubish; obj.Manufacturer.Deleted = obj.isDelete; obj.Manufacturer.CreatedOn = DateTime.Now; // save ManufacturerLocalized obj.ManufacturerLocalized.ManufacturerID = obj.Manufacturer.ManufacturerID; obj.Manufacturer.Fly_ManufacturerLocalized.Add(obj.ManufacturerLocalized); repository.Add(obj.Manufacturer); return(RedirectToAction("Index")); } catch (Exception e) { return(View(e.Message)); } }
public ActionResult Create(BannerModel obj) { try { // TODO: Add insert logic here obj.banner.CreatedOn = DateTime.Now; obj.banner.Deleted = obj.isDelete; obj.banner.Published = obj.isPublish; obj.banner.BannerTypeID = obj.positionType; if (Session["idxu"] != null && Session["idxu"].ToString().Length > 0) { obj.banner.CreatedByID = int.Parse(Session["idxu"].ToString()); } _repository.Add(obj.banner); return RedirectToAction("Index"); } catch (Exception e) { return View(e.Message); } }
public ActionResult Create(BlogPostVm obj) { try { // TODO: Add insert logic here obj.Blogpost.BlogPostTypeID = 1; obj.Blogpost.Published = obj.IsPublish; obj.Blogpost.CreatedOn = DateTime.Now; obj.Blogpost.Tags = ""; if (Session["idxu"] != null && Session["idxu"].ToString().Length > 0) { obj.Blogpost.CreatedByID = int.Parse(Session["idxu"].ToString()); } _repos.Add(obj.Blogpost); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(ex.Message)); } }
public ActionResult Create(ProductVM obj) { try { //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, Createdon = DateTime.Now }); 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 }); obj.Product.Fly_Product_Manufacturer_Mapping.Add(new Fly_Product_Manufacturer_Mapping { ManufacturerID = obj.indexManufacturer }); /* save mapping table ProductVariant width table Discount */ repository.Add(obj.Product); if (obj.Product != null && obj.Product.ProductId > 0) { if (obj.arrRelationProduct != null && obj.arrRelationProduct.Trim().Length > 0) { for (int i = 0; i < obj.arrRelationProduct.Split(',').Length; i++) { _repoRelatedProduct.Add(new Fly_RelatedProduct() { ProductID1 = obj.Product.ProductId, ProductID2 = int.Parse(obj.arrRelationProduct.Split(',')[i]) }); } } } return(RedirectToAction("Index")); } catch (Exception e) { return(View(e.Message)); } }
public ActionResult Create(ProductVM obj) { try { using (TransactionScope scpScope = new TransactionScope()) { //save product table _vm.Product.Name = obj.Product.Name; _vm.Product.ShortDescription = obj.Product.ShortDescription; _vm.Product.FullDescription = obj.Product.FullDescription; _vm.Product.CreatedOn = DateTime.Now; _vm.Product.UpdatedOn = DateTime.Now; _vm.Product.Published = obj.isPublish; _vm.Product.Deleted = obj.isDelete; _vm.Product.isAccessories = true; _vm.Product.ShowOnHomePage = obj.isHome; // save productvariant table _vm.ProductVariant = obj.ProductVariant; _vm.ProductVariant.CreatedOn = DateTime.Now; _vm.ProductVariant.UpdatedOn = DateTime.Now; _vm.ProductVariant.Deleted = _vm.Product.Deleted; _vm.ProductVariant.Name = _vm.Product.Name; _vm.ProductVariant.Description = _vm.Product.FullDescription; _vm.ProductVariant.DisplayOrder = _vm.Product.ProductId; _vm.ProductVariant.Published = _vm.Product.Published; _vm.ProductVariant.IsShipEnabled = obj.isShipEnabled; _vm.ProductVariant.IsFreeShipping = obj.isFreeShipping; _vm.ProductVariant.CallForPrice = obj.isCallForPrice; _vm.ProductVariant.isHot = obj.isHot; _vm.ProductVariant.isNew = obj.isNew; _vm.ProductVariant.isGift = obj.isGift; if (obj.indexDiscount > 0) { _vm.ProductVariant.Fly_ProductVariant_Discount_Mapping.Add(new Fly_ProductVariant_Discount_Mapping { DiscountID = obj.indexDiscount, Createdon = DateTime.Now }); } _vm.Product.Fly_ProductVariant.Add(_vm.ProductVariant); _vm.Product.Fly_ProductLocalized.Add(obj.ProductLocalized); _vm.Product.Fly_ProductPicture.Add(obj.ProductPictures); if (obj.indexCate > 0) { _vm.Product.Fly_Product_Category_Mapping.Add(new Fly_Product_Category_Mapping { CategoryID = obj.indexCate }); } if (obj.indexManufacturer > 0) { _vm.Product.Fly_Product_Manufacturer_Mapping.Add(new Fly_Product_Manufacturer_Mapping { ManufacturerID = obj.indexManufacturer }); } _vm.SectionGalleries.PositionGalleryID = 5; // gallery _vm.SectionGalleries.CollectionImage = obj.SectionGalleries.CollectionImage.Substring(0, obj.SectionGalleries.CollectionImage.Length - 1); _vm.SectionGalleries.CreatedOn = DateTime.Now; _vm.Product.Fly_SectionGallery.Add(_vm.SectionGalleries); /* save mapping table ProductVariant width table Discount */ _repository.Add(_vm.Product); if (obj.Product != null && obj.Product.ProductId > 0) { if (obj.arrRelationProduct != null && obj.arrRelationProduct.Trim().Length > 0) { for (int i = 0; i < obj.arrRelationProduct.Split(',').Length; i++) { _repoRelatedProduct.Add(new Fly_RelatedProduct() { ProductID1 = obj.Product.ProductId, ProductID2 = int.Parse(obj.arrRelationProduct.Split(',')[i]) }); } } } scpScope.Complete(); scpScope.Dispose(); } return(RedirectToAction("Index")); } catch (Exception e) { return(View(e.Message)); } }