Snippets

We've recently added snippets for our developers to develop code quicker.
Before you can get started with snippets you need to tell Visual Studio where to find our snippets. If you don't know how to do that you can follow the steps below.

  1. Open the Tools tab in Visual Studio and open Code Snippets Manager the default shortcut is ctrl + k, ctrl + b.
  2. Select a language in the first drop down list. We currently only have snippets for C# code and HTML code.
  3. Now you want to add the folder with our snippets, Locate the Online solution and go to project CDN, there should be a folder named 2BASnippets in there. That's the folder you want to choose.
  4. Click on OK and you are done! You can access our snippets with the default shortcut ctrl + k, ctrl + x.

That's it. You're done!
You'll be able to use our latest snippets as long as you're up-to-date with your solution!

All Snippets we currently have.

csharp

protected $datatype$ $name$($parameters$)
{
    $end$
}

csharp

public ActionResult $Index$()
{
    $end$
	return View();
}

csharp

$dataBasePath$.Db.Management.ExecuteOnConnection(conn => conn.$executeMethod$<$type$>($query$, $parameters$));

html

<div class="modal-dialog">
	<div class="modal-content">
		@using (Html.BeginForm("ACTION", "CONTROLLER", null, FormMethod.Post, new { role = "form", @id = "formChange" }))
		{
		    <div class="modal-header">
			    <button type="button" data-dismiss="modal" aria-hidden="true" class="close md-close"><i class="fal fa-times"></i></button>
			    <h3 class="modal-title">$title$</h3>
		    </div>

		    <div class="modal-body">$end$
		    </div>

		    <div class="modal-footer">
			    <input type="submit" value="@Generic.Resources.Common.Button.Save" class="btn btn-primary" name="submitButton">
			    <button type="submit" class="btn btn-default" data-dismiss="modal">@Generic.Resources.Common.Button.Cancel</button>
		    </div>
		}
	</div>
</div>

html

<div class="panel panel-default">
	<div class="panel-heading">
		<span class="panel-title">$Title$</span>
	</div>
	<div class="panel-body">$end$
	</div>
</div>

html

<table class="table table-striped datatable-mvc" data-paneltype="@PanelType.$Panel$" data-defaultorder="$defaultOrder$" data-hidecolumns="$hideColumns$" data-disablesort="$disableSort$" data-disablesearch="$disableSearch$">
</table>

html

@using (Html.BeginForm("ACTION", "CONTROLLER", null, FormMethod.Post, new { role = "form", @id = "formChange" }))
{
    $Content$
}

html

<div class="alert alert-danger alert-icon alert-border-color" role="alert">
	<div class="icon"><span class="fal fa-exclamation-triangle"></span></div>
	<div class="message">$selected$ $end$
	</div>
</div>

html

<div class="alert alert-info alert-icon alert-border-color" role="alert">
	<div class="icon"><span class="fal fa-info-circle"></span></div>
	<div class="message">$selected$ $end$
	</div>
</div>

html

<div class="alert alert-primary alert-icon alert-border-color" role="alert">
	<div class="icon"><span class="fal fa-check"></span></div>
	<div class="message">$selected$ $end$
	</div>
</div>

html

<div class="alert alert-success alert-icon alert-border-color" role="alert">
	<div class="icon"><span class="fal fa-check"></span></div>
	<div class="message">$selected$ $end$
	</div>
</div>

html

<div class="alert alert-warning alert-icon alert-border-color" role="alert">
	<div class="icon"><span class="fal fa-exclamation-triangle"></span></div>
	<div class="message">$selected$ $end$
	</div>
</div>

html

<span class='fa fa-spinner fa-spin'></span> <span class='loadtext'>Loading</span>

sql

CASE $expression$
    WHEN $val$ THEN $end$
    ELSE 'Other'
END

sql

IF( $Condition$ )
BEGIN
$end$
END