public ActionResult Edit(CategoryViewModel model, bool continueEditing) { if (ModelState.IsValid) { Picture pic = new Picture(); InsertPicture(pic, model); Category cat = new Category(); cat.Id = model.Id; cat.Name = model.Name; cat.Seo = SeoService.ToSeoUrl(model.Name); cat.Description = model.Description; cat.ParantId = model.ParantId ?? 0; if (pic.Id > 0) { cat.PictureId = pic.Id; } else { cat.PictureId = model.PictureId; } cat.Published = model.Published; cat.OrderNo = model.OrderNo; cat.UpdatedDate = DateTime.Now; cat.UpdatedById = 1; cat.CreatedById = model.CreatedById; cat.CreatedDate = model.CreatedDate; cat.IsActive = true; cat.IsDeleted = false; if (pic.Id > 0) { cat.PictureId = pic.Id; } if (_categoryService.Update(cat) == true) { Success("Güncelleme işlemi Başarılı"); } else { Danger("Güncelleme işlemi Başarısız"); } if (continueEditing) { return(RedirectToAction("Edit", "Category", new { id = model.Id })); } else { return(RedirectToAction("List", "Category")); } } model.CategoryList = GetCategoryDropList(); return(View(model)); }
public ActionResult Edit(BrandViewModel model, bool continueEditing) { Brand _brand = new Brand(); Picture _pic = new Picture(); if (ModelState.IsValid) { InsertPicture(_pic, model); _brand.Id = model.Id; _brand.Name = model.Name; _brand.Description = model.Description; _brand.OrderNo = model.OrderNo; _brand.Seo = SeoService.ToSeoUrl(model.Name); _brand.CreatedById = model.CreatedById; _brand.CreatedDate = model.CreatedDate; _brand.UpdatedById = 1; _brand.UpdatedDate = DateTime.Now; _brand.IsActive = true; _brand.IsDeleted = false; if (_pic.Id > 0) { _brand.PictureId = _pic.Id; } else { _brand.PictureId = model.PictureId; } if (_brandservice.Update(_brand)) { Success("Güncelleme işlemi başarılı bir şekilde gerçekleşti"); } else { Danger("Guncelleme işlemi sırasında bir hata oluştu"); } if (continueEditing) { return(RedirectToAction("Edit", "Brand", new { id = _brand.Id })); } return(RedirectToAction("List", "Brand")); } return(View(model)); }
public ActionResult Create(BrandViewModel model, bool continueEditing) { Brand _brand = new Brand(); Picture _pic = new Picture(); if (ModelState.IsValid) { InsertPicture(_pic, model); //var data = QMapper.CloneClassicVersion(model, typeof(Brand)) as Brand; _brand.Name = model.Name; _brand.Description = model.Description; _brand.OrderNo = model.OrderNo; _brand.Seo = SeoService.ToSeoUrl(model.Name); _brand.CreatedById = 1; _brand.CreatedDate = DateTime.Now; _brand.IsActive = true; _brand.IsDeleted = false; if (_pic.Id > 0) { _brand.PictureId = _pic.Id; } if (_brandservice.Insert(_brand) != null) { Success("Kayit işlemi başarılı bir şekilde gerçekleşti"); } else { Danger("Kayit işlemi sırasında problem oluştu"); } if (continueEditing) { return(RedirectToAction("Edit", "Brand", new { id = _brand.Id })); } else { return(RedirectToAction("List", "Brand")); } } return(View(model)); }
public ActionResult Create(ProductViewModel model, bool continueEditing) { if (ModelState.IsValid) { Product _pro = new Product(); _pro.Name = model.Name; _pro.ShortDescription = model.ShortDescription; _pro.LongDescription = model.LongDescription; _pro.Seo = SeoService.ToSeoUrl(model.Name); _pro.BrandId = model.BrandId; _pro.OldPrice = model.OldPrice; _pro.Price = model.Price; _pro.ProductCost = model.ProductCost; _pro.Qunatity = model.Qunatity; _pro.Sku = model.Sku; _pro.Vat = model.Vat; _pro.ShowOnHomePage = model.ShowOnHomePage; _pro.Published = model.Published; _pro.IsFreeShipping = model.IsFreeShipping; _pro.MetaDescription = model.MetaDescription; _pro.MetaKeywords = model.MetaKeywords; _pro.MetaTitle = model.MetaTitle; if (_productService.Insert(_pro) != null) { ProdutTagMappingUpdateInsert(model.ProductTags, _pro.Id); if (continueEditing) { return(RedirectToAction("Edit", "Product", new { Id = _pro.Id })); } return(RedirectToAction("List", "Product")); } } model.VatList = Enums.VatList(); model.BrandList = GetBrandList(); model.CategoryList = GetCategoryDropList(); return(View(model)); }