# -*- encoding : utf-8 -*- class Admin::MarketDiscountsController < ApplicationController layout "admin" before_action :auth_admin before_action :admin_space def admin_space @admin_space = "clients" end def index @market_discounts = MarketDiscount.order("p_customer_cat_id ASC, min ASC").all end def show @market_discount = MarketDiscount.find(params[:id]) end def new @market_discount = MarketDiscount.new end def edit @market_discount = MarketDiscount.find(params[:id]) end def create @market_discount = MarketDiscount.new(params.require(:market_discount).permit!) if @market_discount.save else render action: "new" end end def update @market_discount = MarketDiscount.find(params[:id]) if @market_discount.update_attributes(params.require(:market_discount).permit!) else render action: "edit" end end def destroy @market_discount = MarketDiscount.find(params[:id]) @market_discount.destroy end end