This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En la clase | |
using System.Collections.Specialized; | |
using System.Configuration; | |
// En el método | |
var secureAppSettings = ConfigurationManager.GetSection("secureAppSettings") as NameValueCollection; | |
var Dato1 = secureAppSettings["Dato1"]; | |
var Dato2 = secureAppSettings["Dato2"]; | |
// En el web.config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ApplicationDbContext db = new ApplicationDbContext()) | |
{ | |
var rm = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(db)); | |
var roleId = rm.FindByName("NombreDeLRol").Name; | |
var usuarios = db.Users.Where(x => x.Roles.Any(y => y.RoleId == roleId)).ToList(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public FileResult Descargar() | |
{ | |
// utilizando la librería DotNetZip | |
using (ZipFile zip = new ZipFile()) | |
{ | |
// tus archivos (Puedes sacarlos de tu base de datos como arreglos de bytes) | |
var archivo1 = Server.MapPath("~/archivosDescargar/ejemplo 1.pdf"); | |
var archivo2 = Server.MapPath("~/archivosDescargar/ejemplo 2.pdf"); | |
var archivo3 = Server.MapPath("~/archivosDescargar/gavilanch2.jpg"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En el Main Activity: | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView (Resource.Layout.Main); | |
var newsTitle = FindViewById<TextView>(Resource.Id.newsTitle); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En mainActivity | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView (Resource.Layout.Main); | |
var newsService = new NewsService(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En mainActivity | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView (Resource.Layout.Main); | |
var newsService = new NewsService(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En Main.axml | |
<?xml version="1.0" encoding="utf-8"?> | |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fillViewport="true"> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="match_parent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nota: Debes remover el MainLauncher del MainActivity.cs | |
// En NewsListRow | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="horizontal" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<TextView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En NewsListRow.axml | |
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<TextView | |
android:text="Small Text" | |
android:textAppearance="?android:attr/textAppearanceSmall" | |
android:layout_width="wrap_content" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En NewsListActivity.cs | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
base.OnCreate(savedInstanceState); | |
// Create your application here | |
SetContentView(Resource.Layout.NewsList); | |
var newsListView = FindViewById<ListView>(Resource.Id.newsListView); |