Yes, it is possible.
You need to mount in your C # code the sql command of backup and run it, something like:
Open the connection and mount a query that executes the backup command according to the path you want to save backup p>
public void ExecutarBackup(string caminho)
{
suaConexao = new SqlConnection(...);
var query = "Backup database NomeSeuBanco to disk='" + caminho + "'";
var cmd = new SqlCommand(query, suaConexao);
cmd.ExecuteNonQuery();
}
Editing / Complement:
And what would I do to put it in a view? Like a button? Or something like that.
Your View can have a control for the user informing the path where he wants to save the backup and a button. When you click the button the Action of your Controller occurs, passing the path that the user wants to save the backup as a parameter. p>
This Action can call a service / method to generate the backup .
[HttpPost]
public ActionResult SalvarBakup(SeuViewModel seuViewModel)
{
_servicoBackup.ExecutarBackup(seuViewModel.Caminho);
return View();
}
Below I'll explain to View:
@model SeuViewModel
@using (Html.BeginForm("SalvarBakup", "SeuController"))
{
@Html.TextBoxFor(model => model.Caminho)
<input type="submit" value="Salvar Backup" />
}