public IActionResult AddSizeRatio(SizeRatio sizeRatioModel) { try { if (ModelState.IsValid) { long sizeRatioId = iSizeRatio.AddSizeRatio(sizeRatioModel); if (sizeRatioId > 0) { return(Ok(ResponseHelper.Success(MessageConstants.SizeRatioAdded))); } else if (sizeRatioId == ReturnCode.AlreadyExist.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentName))); } else { return(Ok(ResponseHelper.Error(MessageConstants.SizeRatioNotAdded))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult UpdateUserCart(UpdateUserCartModel updateUserCartModel) { try { if (ModelState.IsValid) { long isUpdated = iCart.UpdateQuantity(updateUserCartModel.cartId, updateUserCartModel.productId, updateUserCartModel.productColorId, updateUserCartModel.quantity, updateUserCartModel.userId, updateUserCartModel.updatedBy);; if (isUpdated > 0) { return(Ok(ResponseHelper.Success(MessageConstants.QuantityUpdated))); } else { return(Ok(ResponseHelper.Error(MessageConstants.NotQuantityUpdated))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult EmptyUserCart(DeleteUserModel userModel) { try { if (ModelState.IsValid) { var isEmpty = iCart.EmptyCart(DBHelper.ParseInt64(userModel.userId)); if (isEmpty) { return(Ok(ResponseHelper.Success(MessageConstants.RemovedItemFromCart))); } else { return(Ok(ResponseHelper.Error(MessageConstants.CartIsEmpty))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult ProductDetail(GetProductDetailModel productDetailModel) { try { if (ModelState.IsValid) { string scheme = this.Request.Scheme; scheme += "://" + this.Request.Host + this.Request.PathBase; var productDetail = iProduct.GetProductDetail(productDetailModel.productId, scheme); if (productDetail != null) { return(Ok(ResponseHelper.Success(productDetail))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult ProductOrderList(SearchProductListModel searchModel) { try { string scheme = this.Request.Scheme; scheme += "://" + this.Request.Host + this.Request.PathBase; if (searchModel.pageNo <= 0) { searchModel.pageNo = 1; } var productList = iProduct.GetOrderProductList(searchModel.pageNo, searchModel.limit, searchModel.searchString, scheme, searchModel.column, searchModel.direction); if (productList != null) { return(Ok(ResponseHelper.Success(productList))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public ActionResult UserRole(int userId, int roleId) { var userModel = SystemUserRoleMappingHelper.GetUserRoleBy(userId); if (userModel == null) { return(new JsonResult(ResponseHelper.Error("用户不存在"))); } if (roleId == userModel.RoleId) { return(new JsonResult(ResponseHelper.Success("ok"))); } var roleModel = SystemRoleHelper.GetModel(p => p.Id == roleId); if (roleModel == null) { return(new JsonResult(ResponseHelper.Error("该角色不存在!"))); } var userRoleMapping = SystemUserRoleMappingHelper.GetModel(p => p.SystemUserId == userId); if (userRoleMapping == null) { userRoleMapping = new SystemUserRoleMapping { CreatedTime = DateTime.Now, RoleId = roleId, SystemUserId = userId }; SystemUserRoleMappingHelper.Insert(userRoleMapping); return(new JsonResult(ResponseHelper.Success("ok"))); } if (SystemUserRoleMappingHelper.Update(userRoleMapping, p => p.SystemUserId == userId, SystemUserRoleMappingHelper.Columns.RoleId)) { return(new JsonResult(ResponseHelper.Success("ok"))); } return(new JsonResult(ResponseHelper.Error("修改失败!"))); }
public IActionResult DeleteTestimonial(DeleteTestimonialModel deleteModel) { try { if (ModelState.IsValid) { bool isDeleted = iTestimonial.DeleteTestimonial(DBHelper.ParseInt64(deleteModel.TestimonialId)); if (isDeleted) { return(Ok(ResponseHelper.Success(MessageConstants.TestimonialDeleted))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult DeleteProductCategory(DeleteProductCategoryModel model) { try { if (ModelState.IsValid) { bool isDeleted = iProductCategory.DeleteProductCategory(DBHelper.ParseInt64(model.productCategoryId), DBHelper.ParseInt64(model.updatedBy)); if (isDeleted) { return(Ok(ResponseHelper.Success(MessageConstants.ProductCategoryDeleted))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult Registration(AddNewUserModel addNewUserModel) { if (ModelState.IsValid) { User userModel = UserHelper.BindUserModel(addNewUserModel); userModel.CreatedOn = DateTime.Now; userModel.Password = EncryptDecryptHelper.Encrypt(userModel.Password); long userId = iUser.AddUser(userModel); if (userId > 0) { //UserAddress addmodel = UserHelper.BindUserAddress(addNewUserModel); //addmodel.UserFK = userId; //long userAddressId = iUser.AddNewUserAddress(addmodel); return(Ok(ResponseHelper.Success(MessageConstants.UserRegistered))); } else if (userId == ReturnCode.AlreadyExist.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentEmailId))); } else { return(Ok(ResponseHelper.Error(MessageConstants.UserNotRegistered))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } }
public IActionResult ProductCategoryDetail(ProductCategoryDetailModel model) { try { if (ModelState.IsValid) { var productCategoryDetail = iProductCategory.GetProductCategoryDetail(DBHelper.ParseInt64(model.productCategoryId)); if (productCategoryDetail != null) { ProductCategoryListModel productCategoryListModel = ProductCategoryHelper.BindProductCategoryListModel(productCategoryDetail); return(Ok(ResponseHelper.Success(productCategoryListModel))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult AddProductCategory(AddNewProductCategoryModel addproductCategorymodel) { try { if (ModelState.IsValid) { ProductCategory productCategoryModel = ProductCategoryHelper.BindProductCategoryModel(addproductCategorymodel); long productCategoryId = iProductCategory.AddProductCategory(productCategoryModel); if (productCategoryId > 0) { return(Ok(ResponseHelper.Success(MessageConstants.ProductCategoryAdded))); } else if (productCategoryId == ReturnCode.AlreadyExist.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentName))); } else { return(Ok(ResponseHelper.Error(MessageConstants.ProductCategoryNotAdded))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult ProductCategoryList(SearchPaginationListModel model) { try { if (model.pageNo <= 0) { model.pageNo = 1; } var productCategoryList = iProductCategory.GetProductCategory(model.searchString); if (productCategoryList != null) { var productCategoryPagedresult = productCategoryList.OrderByDescending(x => x.ProductCategoryId).ToPagedList(model.pageNo, model.limit).ToList(); List <ProductCategoryListModel> productCategoryListModel = ProductCategoryHelper.BindProductCategoryListModel(productCategoryPagedresult); return(Ok(ResponseHelper.Success(productCategoryListModel))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
/// <summary> /// Orders the list. /// </summary> /// <param name="OrderId">The order identifier.</param> /// <param name="OrderStatusId">The order status identifier.</param> /// <returns></returns> public IActionResult UpdateOrderInvoiceStatus(UpdateOrderInvoiceStatus model) { try { if (ModelState.IsValid) { if (iOrderInvoice.UpdateOrderInvoiceStatus(DBHelper.ParseInt64(model.orderInvoiceId), DBHelper.ParseInt64(model.orderStatusId), DBHelper.ParseInt64(model.updatedBy))) { var orderStatus = DBHelper.ParseInt32(model.orderStatusId); if (orderStatus == OrderStatusEnum.ReadyforPayment.GetHashCode()) { SendPaymentRelatedEmail(DBHelper.ParseInt32(model.orderInvoiceId)); } return(Ok(ResponseHelper.Success(MessageConstants.InvoiceStatusUpdated))); } else { return(Ok(ResponseHelper.Error(MessageConstants.NoOrderFound))); } } return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult DeleteSizeRatio(string sizeRatioId) { try { if (!string.IsNullOrWhiteSpace(sizeRatioId)) { bool isDeleted = iSizeRatio.DeleteSizeRatio(DBHelper.ParseInt64(sizeRatioId)); if (isDeleted) { return(Ok(ResponseHelper.Success(MessageConstants.SizeRatioDeleted))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public ActionResult Create([FromForm] SaveMenuModel model) { // TODO: Add insert logic here //查询是否存在该菜单 if (SystemMenuHelper.Exists(p => p.Name == model.ControllName && p.ActionRoute == model.ControllUrl)) { return(Json(ResponseHelper.Error("该菜单已经存在了!"))); } var MenuModel = new SystemMenu { ActionRoute = model.ControllUrl.ToLower(), CreatedTime = DateTime.Now, Icon = model.Icon, IsUse = Convert.ToBoolean(model.Status), Name = model.ControllName, ParentId = Convert.ToInt32(model.ParentCode), Remark = model.Remark, Sort = model.Sort, Type = model.ControllType }; var menuId = SystemMenuHelper.Insert(MenuModel); //给系统预留角色把权限绑上 RoleAuthMappingHelper.Insert(new RoleAuthMapping { CreatedTime = DateTime.Now, MenuId = menuId, RoleId = 1 }); if (CacheUser.UId == "1") { CacheUser.AuthMenu.Add(menuId); HttpContext.Session.SetString("UserInfo", JsonConvert.SerializeObject(CacheUser)); } return(Json(ResponseHelper.Success("ok"))); }
public IActionResult GetStyleProductList(SearchProductListModel searchModel) { try { string scheme = this.Request.Scheme; scheme += "://" + this.Request.Host + this.Request.PathBase; StyleCampaignList styleCampaignList = new StyleCampaignList(); if (searchModel.pageNo <= 0) { searchModel.pageNo = 1; } styleCampaignList = iStyleCampaign.GetStyleCampaignList(DBHelper.ParseString((int)ProductCategoryEnum.Styles), searchModel.searchString, searchModel.pageNo, searchModel.limit, searchModel.CategoryTypeId, scheme, searchModel.column, searchModel.direction); if (styleCampaignList != null) { return(Ok(ResponseHelper.Success(styleCampaignList))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public ActionResult Edit([FromForm] SystemUserEdit model) { if (model.Id == 1) { return(Json(ResponseHelper.Error("该用户不可被编辑"))); } if (!string.IsNullOrEmpty(model.Pwd)) { if (model.Pwd.Length < 6 || model.Pwd.Length > 16) { return(Json(ResponseHelper.Error("密码长度不能少于6位大于16位!"))); } } var UserModel = SystemUserHelper.GetModel(model.Id); //查询是否存重名 if (SystemUserHelper.Exists(p => p.Id != model.Id && (p.Phone.Equals(model.Phone) || p.Email.Equals(model.Email)))) { return(Json(new { status = 0, msg = "已存在相同的手机号或者邮箱,请修改!" })); } UserModel.Email = model.Email; UserModel.Status = model.IsUse; UserModel.NickName = model.Name; UserModel.Phone = model.Phone; if (!string.IsNullOrEmpty(model.Pwd)) { UserModel.Password = AESUtil.Md5(model.Pwd); } SystemUserHelper.Update(UserModel); return(Json(ResponseHelper.Success("ok"))); }
public IActionResult DeleteProductCategoryType(DeleteProductCategoryTypeModel deleteModel) { try { if (!string.IsNullOrWhiteSpace(deleteModel.productCategoryTypeId) && !string.IsNullOrWhiteSpace(deleteModel.updatedBy)) { bool isDeleted = iProductCategoryType.DeleteProductCategoryType(DBHelper.ParseInt64(deleteModel.productCategoryTypeId), DBHelper.ParseInt64(deleteModel.updatedBy)); if (isDeleted) { return(Ok(ResponseHelper.Success(MessageConstants.ProductCategoryTypeDeleted))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult Updatecolor(AddColorModel addColorModel) { try { if (ModelState.IsValid) { Color colorModel = ColorHelper.BindColorModel(addColorModel); long colorId = iColor.UpdateColor(colorModel); if (colorId > 0) { return(Ok(ResponseHelper.Success(MessageConstants.ColorUpdated))); } else if (colorId == ReturnCode.AlreadyExist.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.ColorExists))); } else { return(Ok(ResponseHelper.Error(MessageConstants.ColorNotUpdated))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult UpdateProductCategoryType(UpdateProductCategoryTypeModel updateProductCategoryTypeModel) { try { if (ModelState.IsValid) { ProductCategoryType productCategoryTypeModel = ProductCategoryTypeHelper.BindProductCategoryModel(updateProductCategoryTypeModel); long productCategoryTypeId = iProductCategoryType.UpdateProductCategoryType(productCategoryTypeModel, DBHelper.ParseInt64(productCategoryTypeModel.UpdatedBy)); if (productCategoryTypeId > 0) { return(Ok(ResponseHelper.Success(MessageConstants.ProductCategoryTypeUpdated))); } else if (productCategoryTypeId == ReturnCode.AlreadyExist.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentName))); } else { return(Ok(ResponseHelper.Error(MessageConstants.ProductCategoryTypeNotUpdated))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult DeleteProduct(DeleteProductModel deleteModel) { try { if (ModelState.IsValid) { var isDeleted = iProduct.DeleteProduct(deleteModel.productId, deleteModel.updatedBy); if (isDeleted) { return(Ok(ResponseHelper.Success(MessageConstants.ProductDeleted))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult ProductCategoryTypeDetail(ProductCategoryTypeDetailModel productCategoryTypeModel) { try { if (!string.IsNullOrWhiteSpace(productCategoryTypeModel.productCategoryTypeId)) { var productCategoryTypeDetail = iProductCategoryType.ProductCategoryTypeDetail(DBHelper.ParseInt64(productCategoryTypeModel.productCategoryTypeId)); if (productCategoryTypeDetail != null) { ProductCategoryTypeDataModel productCategoryTypeDataModel = ProductCategoryTypeHelper.BindProductCategoryTypeListModel(productCategoryTypeDetail); return(Ok(ResponseHelper.Success(productCategoryTypeDataModel))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult ChangeProductStatus(ChangeProductStatus productStatusModel) { try { if (ModelState.IsValid) { var productDetail = iProduct.ChangeProductStatus(productStatusModel.productId, productStatusModel.Status); if (productDetail) { return(Ok(ResponseHelper.Success(MessageConstants.ProductStatusUpdated))); } else { return(Ok(ResponseHelper.Error(MessageConstants.ProductStatusNotUpdated))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult UpdateUserPassword(UpdateUserPasswordModel updateUserModel) { try { if (ModelState.IsValid) { updateUserModel.oldPassword = EncryptDecryptHelper.Encrypt(updateUserModel.oldPassword); updateUserModel.newPassword = EncryptDecryptHelper.Encrypt(updateUserModel.newPassword); var isUpdated = iUser.UpdatePassword(updateUserModel.oldPassword, updateUserModel.newPassword, updateUserModel.userId); if (isUpdated > 0) { return(Ok(ResponseHelper.Success(MessageConstants.PasswordUpdated))); } else if (isUpdated == ReturnCode.NotMatching.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.OldPasswordNotMatching))); } else { return(Ok(ResponseHelper.Error(MessageConstants.PasswordNotUpdated))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult DeleteProductColor(DeleteProductColorModel deleteModel) { try { if (ModelState.IsValid) { var hostingPath = env.ContentRootPath; var isDeleted = iProduct.DeleteProductColor(deleteModel.ProductId, deleteModel.ColorId, hostingPath); if (isDeleted) { return(Ok(ResponseHelper.Success(MessageConstants.ProductColorDeleted))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult GetUserPassword(DeleteUserModel deleteModel) { try { if (ModelState.IsValid) { var password = iUser.GetUserPassword(DBHelper.ParseInt64(deleteModel.userId)); if (!string.IsNullOrWhiteSpace(password)) { password = EncryptDecryptHelper.Decrypt(password); return(Ok(ResponseHelper.Success(DBHelper.ParseString(password)))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult GetUserCartDetails(DeleteUserModel userModel) { try { if (ModelState.IsValid) { string scheme = this.Request.Scheme; scheme += "://" + this.Request.Host + this.Request.PathBase; var userCartDetail = iCart.GetUserCartDetail(DBHelper.ParseInt64(userModel.userId), scheme); if (userCartDetail != null) { return(Ok(ResponseHelper.Success(userCartDetail))); } else { return(Ok(ResponseHelper.Error(MessageConstants.UserCartEmpty))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public ActionResult RoleMenu([FromForm] AuthSaveMenu model) { var role = SystemRoleHelper.GetModel(p => p.Id == model.RoleId); if (role == null) { return(Json(ResponseHelper.Error("不存在的角色!"))); } var menuList = RoleAuthMappingHelper.GetList(p => p.RoleId == model.RoleId); if (menuList.Count > 0) { var menuStr = string.Join(",", menuList.Select(p => p.MenuId).ToArray()); if (menuStr.Equals(model.Menus)) { return(Json(ResponseHelper.Success("OK"))); } } RoleAuthMappingHelper.Delete(p => p.RoleId == model.RoleId); var menuArr = model.Menus.Split(",").ToList(); List <RoleAuthMapping> insertList = new List <RoleAuthMapping>(); foreach (var i in menuArr) { insertList.Add(new RoleAuthMapping { CreatedTime = DateTime.Now, MenuId = Convert.ToInt32(i), RoleId = role.Id }); } RoleAuthMappingHelper.InsertMany(insertList); return(Json(ResponseHelper.Success("ok"))); }
public IActionResult AddToUserCart(AddToCartModel addToCartModel) { try { if (ModelState.IsValid) { UserCartDetails cartModel = CartHelper.BindUserCartDetails(addToCartModel); cartModel.CreatedOn = DateTime.Now; long cartId = iCart.AddToCart(cartModel); if (cartId > 0) { //return Ok(ResponseHelper.Success(MessageConstants.AddedToCart)); return(Ok(ResponseHelper.Success(cartId))); } else if (cartId == ReturnCode.AlreadyExist.GetHashCode()) { return(Ok(ResponseHelper.Error(MessageConstants.ExistInCart))); } else { return(Ok(ResponseHelper.Error(MessageConstants.NotAddedToCart))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public IActionResult SizeRatioList(int pageNo, int limit, string searchString) { try { if (pageNo <= 0) { pageNo = 1; } var sizeRatioList = iSizeRatio.GetSizeRatioList(searchString); if (sizeRatioList != null) { var sizeRatiopagedresult = sizeRatioList.OrderByDescending(x => x.SizeRatioId).ToPagedList(pageNo, limit).ToList(); return(Ok(ResponseHelper.Success(sizeRatiopagedresult))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }