Commit 17b967c5 by Nguyen Quoc Kien

New brach review code

parent ab64a07d
class Admin::CartsController < ApplicationController
before_action :authenticate_admin!
def index
@users = User.all
end
......@@ -25,4 +25,5 @@ class Admin::CartsController < ApplicationController
@cart.update(status: status)
redirect_to admin_cart_path(id: params[:user_id])
end
end
......@@ -58,6 +58,7 @@ class Admin::ProductsController < ApplicationController
end
private
def find_product
@product = Product.find(params[:id])
end
......
class Admin::UsersController < ApplicationController
before_action :authenticate_admin!
def index
@users = User.paginate(page: params[:page]).per_page(21)
end
before_action :authenticate_admin!
def destroy
@user = User.find(params[:id])
if @user.destroy
def index
@users = User.paginate(page: params[:page]).per_page(21)
end
def destroy
@user = User.find(params[:id])
if @user.destroy
flash[:success] = "Delete User : Success"
else
flash[:danger] = "Delete User : Error"
end
redirect_to admin_users_path
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment