@provider_status.overwrite
respond_to do |format|
if @provider_status.save
- format.html { redirect_to @provider_status, notice: 'ProviderStatus was successfully updated.' }
+ flash[:notice] = I18n.t('provider_statuses.flash.notice.created')
+ format.html { redirect_to @provider_status }
format.json { head :ok }
else
format.html { render action: "edit" }
def destroy
@provider_status = ProviderStatus.edit(params[:id], @admin)
- @provider_status.destroy
respond_to do |format|
- format.html { redirect_to comics_url }
- format.json { head :ok }
+ if @provider_status.stop
+ flash[:notice] = I18n.t('provider_statuses.flash.notice.stopped')
+ format.html { redirect_to provider_statuses_url }
+ format.json { head :ok }
+ else
+ flash[:notice] = I18n.t('provider_statuses.flash.notice.not_stopped')
+ format.html { render action: "edit" }
+ format.json { render json: @provider_status.errors, status: :unprocessable_entity }
+ end
end
end
end