public ActionResult Update(int ProductID) { B_Commerce.SMVC.Areas.Admin.Models.GetProductModelResponse Response = WebApiOperation.SendPost <int, B_Commerce.SMVC.Areas.Admin.Models.GetProductModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETPRODUCTBYID, ProductID); if (!ModelState.IsValid) { return(View("~/Areas/Admin/Views/Product/Add.cshtml", Response.GetProductModel)); } if (Request.Files.Count > 0) { //resim var string path = Server.MapPath("/"); if (!Directory.Exists(path + "/ProductImage")) { Directory.CreateDirectory(path + "/ProductImage"); } for (int i = 0; i < Request.Files.Count; i++) { string imagePath = path + "/ProductImage/" + Request.Files[i].FileName; Request.Files[i].SaveAs(imagePath); Response.GetProductModel.ImageUrls.Add("/ProductImage/" + Request.Files[i].FileName); } } if (Response.Code != 0) { ViewBag.error = Response.Message; return(View("~/Areas/Admin/Views/Product/Add.cshtml", Response.GetProductModel)); } ViewBag.error = MyResource.Resource.General_Success; return(View("~/Areas/Admin/Views/Product/Add.cshtml", Response.GetProductModel)); }
public ActionResult ProductSpeacialAreaAdd() { string[] SID = HttpContext.Request.Form.GetValues(0); string[] PID = HttpContext.Request.Form.GetValues(1); ProductSpecialAreaModel productSpecialAreaModel = new ProductSpecialAreaModel { SpecialAreaID = int.Parse(SID[0]), ProductID = int.Parse(PID[0]) }; if (!ModelState.IsValid) { return(View()); } GetProductSpecialAreaResponse getProductSpecialAreaResponse = WebApiOperation.SendPost <B_Commerce.SMVC.Areas.Admin.Models.ProductSpecialAreaModel, GetProductSpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_PRODUCT_SPECIAL_AREA_ADD, productSpecialAreaModel); if (getProductSpecialAreaResponse.Code == 0) { ViewBag.error = MyResource.Resource.General_Success; return(RedirectToAction("SpecialAreaProduct", "Product")); } ViewBag.error = getProductSpecialAreaResponse.Message; return(RedirectToAction("Error", "Home")); }
public ActionResult Index() { AdminCategoryIndexModel adminCategoryIndexModel = new AdminCategoryIndexModel(); CategoryModelResponse categoryChangeResponse = WebApiOperation.SendPost <int, CategoryModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_INDEX_URI, 0); adminCategoryIndexModel.CategoryModelResponse = categoryChangeResponse; return(View(adminCategoryIndexModel)); }
public PartialViewResult AddFormPartial() { CategoryShortInfoResponse response1 = WebApiOperation.SendPost <int, CategoryShortInfoResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GET_CATEGORY_SHORT_INFO, 1); ViewData["shortInfoCategories"] = response1.CategoryShortInfos; return(PartialView("_PartialAddCategory")); }
public ActionResult Update(CategoryUpdateRequest request) { //doldur CommonResponse updateResponse = WebApiOperation.SendPost <CategoryUpdateRequest, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_UPDATE_CATEGORY, request); TempData["ResponseCode"] = updateResponse.Code; TempData["ResponseMessage"] = updateResponse.Message; return(RedirectToAction("Index", "Category")); }
public ActionResult Delete(int ID) { //doldur CommonResponse deleteResponse = WebApiOperation.SendPost <int, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_DELETE_CATEGORY, ID); TempData["ResponseCode"] = deleteResponse.Code; TempData["ResponseMessage"] = deleteResponse.Message; return(RedirectToAction("Index", "Category")); }
public ActionResult GetSpecialAreas() { SpecialAreaResponse specialAreaResponse = WebApiOperation.SendPost <object, SpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETSPECIAL_AREA, null); if (specialAreaResponse.Code != 0) { ViewBag.error = specialAreaResponse.Message; return(PartialView("_PartialSpacialArea")); } return(PartialView("_PartialSpacialArea", specialAreaResponse.SpecialAreas)); }
public ActionResult SpecialAreaUpdate(SpecialAreaModel specialAreaModel) { B_Commerce.SMVC.Areas.Admin.Models.SpecialAreaResponse Response = WebApiOperation.SendPost <SpecialAreaModel, B_Commerce.SMVC.Areas.Admin.Models.SpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_UPDATESPECIAL_AREA, specialAreaModel); B_Commerce.SMVC.Areas.Admin.Models.SpecialAreaResponse special = WebApiOperation.SendPost <int, B_Commerce.SMVC.Areas.Admin.Models.SpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETSPECIAL_AREA_BYID, specialAreaModel.ID); if (Response.Code != 0) { ViewBag.error = Response.Message; return(View("~/Areas/Admin/Views/Product/SpecialArea.cshtml", special.SpecialAreas[0])); } ViewBag.error = MyResource.Resource.General_Success; return(View("~/Areas/Admin/Views/Product/SpecialArea.cshtml", special.SpecialAreas[0])); }
public ActionResult Update(ProductModel productmodel) { //productmodel.ID = Request; CommonResponse Response = WebApiOperation.SendPost <ProductModel, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_UPDATE, productmodel); B_Commerce.SMVC.Areas.Admin.Models.GetProductModelResponse product = WebApiOperation.SendPost <int, B_Commerce.SMVC.Areas.Admin.Models.GetProductModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETPRODUCTBYID, productmodel.ID); if (Response.Code != 0) { ViewBag.error = Response.Message; return(View("~/Areas/Admin/Views/Product/Add.cshtml", product.GetProductModel)); } ViewBag.error = MyResource.Resource.General_Success; return(View("~/Areas/Admin/Views/Product/Add.cshtml", product.GetProductModel)); }
public PartialViewResult UpdateFormPartial(int id) { CategoryShortInfoResponse response1 = WebApiOperation.SendPost <int, CategoryShortInfoResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GET_CATEGORY_SHORT_INFO, 1); ViewData["shortInfoCategories"] = response1.CategoryShortInfos; if (id == 0) { return(PartialView("_PartialUpdateCategory", null)); } CategoryDetailModelResponse response = WebApiOperation.SendPost <int, CategoryDetailModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETBYID_CATEGORY, id); return(PartialView("_PartialUpdateCategory", response.Category)); }
public ActionResult SpecialArea(B_Commerce.SMVC.Areas.Admin.Models.SpecialAreaModel specialAreaModel) { if (!ModelState.IsValid) { return(View()); } SpecialAreaResponse specialAreaResponse = WebApiOperation.SendPost <B_Commerce.SMVC.Areas.Admin.Models.SpecialAreaModel, SpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_SPECIAL_AREA, specialAreaModel); if (specialAreaResponse.Code != 0) { ViewBag.error = specialAreaResponse.Message; return(View()); } ViewBag.error = MyResource.Resource.General_Success; return(View()); }
public ActionResult Add(CategoryAddRequest request) { request.isActive = true; AdminCategoryIndexModel adminCategoryIndexModel = new AdminCategoryIndexModel(); if (!ModelState.IsValid) { adminCategoryIndexModel.CategoryAddRequest = request; return(RedirectToAction("Index", "Category", adminCategoryIndexModel)); } CommonResponse addResponse = WebApiOperation.SendPost <CategoryAddRequest, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_ADD_CATEGORY, request); TempData["ResponseCode"] = addResponse.Code; TempData["ResponseMessage"] = addResponse.Message; //mesajlar sayfaya donulecek return(RedirectToAction("Index", "Category", adminCategoryIndexModel)); }
public JsonResult GetProductListJson() { GetProductRequest request = new GetProductRequest { CategoryID = 0, Page = 1, Range = 20, BrandID = 0, Color = "" }; //servis kısmının model response kısmı farklı. ProductModelResponse productModelResponse = WebApiOperation.SendPost <GetProductRequest, ProductModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETPRODUCTS, request); if (productModelResponse.Code == Constants.LOGIN_RESPONSE_SUCCESS) { return(Json(productModelResponse.Products)); } ViewBag.Error = productModelResponse.Message; return(Json("")); }
public ActionResult Login(LoginModel loginModel) { if (!ModelState.IsValid) { return(View("Login", loginModel)); } LoginResponse loginResponse = WebApiOperation.SendPost <LoginModel, LoginResponse>(Constants.LOGIN_API_BASE_URI, Constants.LOGIN_API_LOGIN_URI, loginModel); if (loginResponse.Code == Constants.LOGIN_RESPONSE_SUCCESS) { //işlem basarılı if (!loginResponse.UserRole.Contains("Admin")) { ViewBag.error = "Yetkisiz kullanıcı"; return(View("Login", loginModel)); } UserAdmin.CurrentUserAdmin = new UserAdmin { Name = loginResponse.Username, ExpireDate = loginResponse.ExpireDate, IsValid = loginResponse.IsVerify, Token = loginResponse.Token, Email = loginResponse.Email, Roles = loginResponse.UserRole }; return(RedirectToAction("Index", "Home")); } ViewBag.error = loginResponse.Message; return(View(loginModel)); //return View("~/Areas/Admin/Views/Account/Login.cshtml", loginModel); }
public ActionResult SpecialAreaProduct() { SpecialAreaResponse specialAreaResponse = WebApiOperation.SendPost <object, SpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETSPECIAL_AREA, null); GetProductRequest request = new GetProductRequest { CategoryID = 0, Page = 1, Range = 20, BrandID = 0, Color = "" }; ProductModelResponse productModelResponse = WebApiOperation.SendPost <GetProductRequest, ProductModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETPRODUCTS, request); GetProductSpecialAreaResponse getProductSpecialAreaResponse = WebApiOperation.SendPost <string, GetProductSpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GET_PRODUCT_SPECIAL_AREA, ""); if (productModelResponse.Code == Constants.LOGIN_RESPONSE_SUCCESS) { specialAreaResponse.productModels.AddRange(productModelResponse.Products); } if (getProductSpecialAreaResponse.Code == Constants.LOGIN_RESPONSE_SUCCESS) { specialAreaResponse.productSpecialAreaModels.AddRange(getProductSpecialAreaResponse.ProductSpecialAreaModels); } if (specialAreaResponse.Code != 0) { ViewBag.error = specialAreaResponse.Message; return(View()); } return(View(specialAreaResponse)); }
public ActionResult Add(ProductModel productModel) { //productservisten categorylistesini al if (!ModelState.IsValid) { return(View()); } if (Request.Files.Count > 0) { //resim var string path = Server.MapPath("/"); if (!Directory.Exists(path + "/ProductImage")) { Directory.CreateDirectory(path + "/ProductImage"); } for (int i = 0; i < Request.Files.Count; i++) { string imagePath = path + "/ProductImage/" + Request.Files[i].FileName; Request.Files[i].SaveAs(imagePath); productModel.ProductImages.Add("/ProductImage/" + Request.Files[i].FileName); } } CommonResponse categoryChangeResponse = WebApiOperation.SendPost <ProductModel, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_ADD, productModel); if (categoryChangeResponse.Code != 0) { ViewBag.error = categoryChangeResponse.Message; return(View()); } ViewBag.error = MyResource.Resource.General_Success; return(View()); }
public JsonResult GetCategoryShortInfo() { CategoryShortInfoResponse response = WebApiOperation.SendPost <int, CategoryShortInfoResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GET_CATEGORY_SHORT_INFO, 1); return(Json(response)); }
public JsonResult GetCategoryByID(int id) { CategoryDetailModelResponse response = WebApiOperation.SendPost <int, CategoryDetailModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETBYID_CATEGORY, id); return(Json(response)); }
public JsonResult GetCategoryByMasterID(int id) { CategoryModelResponse categoryChangeResponse = WebApiOperation.SendPost <int, CategoryModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_INDEX_URI, id); return(Json(categoryChangeResponse)); }
public JsonResult GetAllCategories() { CategoryModelResponse categoryChangeResponse = WebApiOperation.SendPost <int, CategoryModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_INDEX_URI, 0); return(Json(categoryChangeResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteSpecialAreaByID(int ID) { CommonResponse Response = WebApiOperation.SendPost <int, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_DELETE_SPECIAL_AREA, ID); return(View("~/Areas/Admin/Views/Product/SpecialArea.cshtml")); }
public ActionResult DeleteProductSpecialAreaByID(int ProductID, int SpecialAreaID) { CommonResponse Response = WebApiOperation.SendPost <object, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_PRODUCT_SPECIAL_AREA_DELETE, new { ProductId = ProductID, SpecialAreaId = SpecialAreaID }); return(RedirectToAction("SpecialAreaProduct", "Product")); }