();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:61792",
7 | "sslPort": 44344
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development",
16 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
17 | }
18 | },
19 | "MiPrimerAppWeb": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
23 | "environmentVariables": {
24 | "ASPNETCORE_ENVIRONMENT": "Development",
25 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.HttpsPolicy;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using Microsoft.Extensions.Hosting;
11 |
12 | namespace MiPrimerAppWeb
13 | {
14 | public class Startup
15 | {
16 | public Startup(IConfiguration configuration)
17 | {
18 | Configuration = configuration;
19 | }
20 |
21 | public IConfiguration Configuration { get; }
22 |
23 | // This method gets called by the runtime. Use this method to add services to the container.
24 | public void ConfigureServices(IServiceCollection services)
25 | {
26 | services.AddControllersWithViews();
27 | }
28 |
29 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
31 | {
32 | if (env.IsDevelopment())
33 | {
34 | app.UseDeveloperExceptionPage();
35 | }
36 | else
37 | {
38 | app.UseExceptionHandler("/Home/Error");
39 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
40 | app.UseHsts();
41 | }
42 | app.UseHttpsRedirection();
43 | app.UseStaticFiles();
44 |
45 | app.UseRouting();
46 |
47 | app.UseAuthorization();
48 |
49 | app.UseEndpoints(endpoints =>
50 | {
51 | endpoints.MapControllerRoute(
52 | name: "default",
53 | pattern: "{controller=Home}/{action=Index}/{id?}");
54 | });
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Home Page";
3 | }
4 |
5 |
6 |
NetCode27
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Home/Privacy.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Privacy Policy";
3 | }
4 | @ViewData["Title"]
5 |
6 | Use this page to detail your site's privacy policy.
7 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Persona/Buscar.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaViewModel
2 | @{
3 | ViewData["Title"] = "Buscar";
4 | Layout = "~/Views/Shared/_Layout.cshtml";
5 | }
6 |
7 | Buscar
8 |
9 |
10 |
11 |
12 |
13 | @using (Html.BeginForm())
14 | {
15 |
16 | Id:
17 |
18 | Introduzca un ID.
19 |
20 |
21 |
Buscar
22 | }
23 |
24 |
25 |
26 | @if (Model.persona != null)
27 | {
28 |
Resultado:
29 |
30 |
59 | }
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Persona/Crear.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaDTO
2 |
3 | @{
4 | ViewData["Title"] = "Crear";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 | Crear Persona
9 |
10 |
11 |
46 |
47 |
50 |
51 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Persona/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Index";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 | Lista de Personas
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Id
17 | Nombre
18 | Apellido Paterno
19 | Apellido Materno
20 | Edad
21 | Eliminar
22 | Actualizar
23 |
24 |
25 |
26 | @foreach (var item in Model.personas)
27 | {
28 |
29 | @item.Id
30 | @item.Nombre
31 | @item.ApPaterno
32 | @item.ApMaterno
33 | @item.Edad
34 |
35 |
36 |
37 |
38 | }
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewData["Title"] - MiPrimerAppWeb
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Inicio
15 |
17 |
18 |
19 |
40 |
41 |
42 |
43 |
44 |
45 | @RenderBody()
46 |
47 |
48 |
49 |
54 |
55 |
56 |
57 | @RenderSection("Scripts", required: false)
58 |
59 |
60 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using MiPrimerAppWeb
2 | @using MiPrimerAppWeb.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/assets/Logo_NetCode27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/assets/Logo_NetCode27.png
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | for details on configuring this project to bundle and minify static web assets. */
3 |
4 | a.navbar-brand {
5 | white-space: normal;
6 | text-align: center;
7 | word-break: break-all;
8 | }
9 |
10 | /* Provide sufficient contrast against white background */
11 | a {
12 | color: #0366d6;
13 | }
14 |
15 | .btn-primary {
16 | color: #fff;
17 | background-color: #1b6ec2;
18 | border-color: #1861ac;
19 | }
20 |
21 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link {
22 | color: #fff;
23 | background-color: #1b6ec2;
24 | border-color: #1861ac;
25 | }
26 |
27 | /* Sticky footer styles
28 | -------------------------------------------------- */
29 | html {
30 | font-size: 14px;
31 | }
32 | @media (min-width: 768px) {
33 | html {
34 | font-size: 16px;
35 | }
36 | }
37 |
38 | .border-top {
39 | border-top: 1px solid #e5e5e5;
40 | }
41 | .border-bottom {
42 | border-bottom: 1px solid #e5e5e5;
43 | }
44 |
45 | .box-shadow {
46 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
47 | }
48 |
49 | button.accept-policy {
50 | font-size: 1rem;
51 | line-height: inherit;
52 | }
53 |
54 | /* Sticky footer styles
55 | -------------------------------------------------- */
56 | html {
57 | position: relative;
58 | min-height: 100%;
59 | }
60 |
61 | body {
62 | /* Margin bottom by footer height */
63 | margin-bottom: 60px;
64 | }
65 | .footer {
66 | position: absolute;
67 | bottom: 0;
68 | width: 100%;
69 | white-space: nowrap;
70 | line-height: 60px; /* Vertically center the text there */
71 | }
72 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | // for details on configuring this project to bundle and minify static web assets.
3 |
4 | // Write your JavaScript code.
5 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2018 Twitter, Inc.
4 | Copyright (c) 2011-2018 The Bootstrap Authors
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .NET Foundation. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | these files except in compliance with the License. You may obtain a copy of the
5 | License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed
10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 | specific language governing permissions and limitations under the License.
13 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/MiPrimerAppWeb/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright JS Foundation and other contributors, https://js.foundation/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30104.148
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPINetCode27", "WebAPINetCode27\WebAPINetCode27.csproj", "{D304A2C8-54F9-4A69-9C30-51F76278D234}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiPrimerAppWeb", "MiPrimerAppWeb\MiPrimerAppWeb.csproj", "{CD6C347A-07B0-425B-996E-5486B221F02A}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {00F1CCC2-19F3-4BA4-AF91-A2BB8856A06E}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "dotnet-ef": {
6 | "version": "3.1.5",
7 | "commands": [
8 | "dotnet-ef"
9 | ]
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/Controllers/WeatherForecastController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.Extensions.Logging;
7 |
8 | namespace WebAPINetCode27.Controllers
9 | {
10 | [ApiController]
11 | [Route("[controller]")]
12 | public class WeatherForecastController : ControllerBase
13 | {
14 | private static readonly string[] Summaries = new[]
15 | {
16 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
17 | };
18 |
19 | private readonly ILogger _logger;
20 |
21 | public WeatherForecastController(ILogger logger)
22 | {
23 | _logger = logger;
24 | }
25 |
26 | [HttpGet]
27 | public IEnumerable Get()
28 | {
29 | var rng = new Random();
30 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
31 | {
32 | Date = DateTime.Now.AddDays(index),
33 | TemperatureC = rng.Next(-20, 55),
34 | Summary = Summaries[rng.Next(Summaries.Length)]
35 | })
36 | .ToArray();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/CorsAuthorizationFilterFactory.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc.Filters;
2 |
3 | namespace WebAPINetCode27
4 | {
5 | internal class CorsAuthorizationFilterFactory : IFilterMetadata
6 | {
7 | private string v;
8 |
9 | public CorsAuthorizationFilterFactory(string v)
10 | {
11 | this.v = v;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/Model/PersonaDTO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace WebAPINetCode27.Model
7 | {
8 | public class PersonaDTO
9 | {
10 | public int Id { get; set; }
11 | public string Nombre { get; set; }
12 | public string ApPaterno { get; set; }
13 | public string ApMaterno { get; set; }
14 | public int Edad { get; set; }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/ModelDB/NetCode27Context.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata;
4 |
5 | namespace WebAPINetCode27.ModelDB
6 | {
7 | public partial class NetCode27Context : DbContext
8 | {
9 | public NetCode27Context()
10 | {
11 | }
12 |
13 | public NetCode27Context(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | public virtual DbSet Personas { get; set; }
19 |
20 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
21 | {
22 | if (!optionsBuilder.IsConfigured)
23 | {
24 | optionsBuilder.UseSqlServer("Server=tcp:netcode27.database.windows.net,1433;Initial Catalog=netcode27;Persist Security Info=False;User ID=usuarionet;Password=Tab2020Net;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
25 | }
26 | }
27 |
28 | protected override void OnModelCreating(ModelBuilder modelBuilder)
29 | {
30 | modelBuilder.Entity(entity =>
31 | {
32 | entity.Property(e => e.ApMaterno).IsRequired();
33 |
34 | entity.Property(e => e.ApPaterno).IsRequired();
35 |
36 | entity.Property(e => e.Nombre).IsRequired();
37 | });
38 |
39 | OnModelCreatingPartial(modelBuilder);
40 | }
41 |
42 | partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/ModelDB/Personas.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace WebAPINetCode27.ModelDB
5 | {
6 | public partial class Personas
7 | {
8 | public int Id { get; set; }
9 | public string Nombre { get; set; }
10 | public string ApPaterno { get; set; }
11 | public string ApMaterno { get; set; }
12 | public int Edad { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace WebAPINetCode27
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:58723",
8 | "sslPort": 44314
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "weatherforecast",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "WebAPINetCode27": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "weatherforecast",
24 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.HttpsPolicy;
8 | using Microsoft.AspNetCore.Mvc;
9 | using Microsoft.Extensions.Configuration;
10 | using Microsoft.Extensions.DependencyInjection;
11 | using Microsoft.Extensions.Hosting;
12 | using Microsoft.Extensions.Logging;
13 |
14 | namespace WebAPINetCode27
15 | {
16 | public class Startup
17 | {
18 | public Startup(IConfiguration configuration)
19 | {
20 | Configuration = configuration;
21 | }
22 |
23 | public IConfiguration Configuration { get; }
24 |
25 | // This method gets called by the runtime. Use this method to add services to the container.
26 | public void ConfigureServices(IServiceCollection services)
27 | {
28 | services.AddControllers();
29 |
30 | services.AddCors(o => o.AddPolicy("AllowMyOrigin", builder =>
31 | {
32 | builder.AllowAnyOrigin()
33 | .AllowAnyMethod()
34 | .AllowAnyHeader();
35 | }));
36 |
37 | }
38 |
39 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
40 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
41 | {
42 | if (env.IsDevelopment())
43 | {
44 | app.UseDeveloperExceptionPage();
45 | }
46 |
47 | app.UseHttpsRedirection();
48 |
49 | app.UseRouting();
50 |
51 | app.UseCors("AllowMyOrigin");
52 |
53 | app.UseAuthorization();
54 |
55 | app.UseEndpoints(endpoints =>
56 | {
57 | endpoints.MapControllers();
58 | });
59 |
60 |
61 |
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WebAPINetCode27
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/WebAPINetCode27.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | all
13 | runtime; build; native; contentfiles; analyzers; buildtransitive
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/sesiones/sesion_06/WebAPINetCode27/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.local/ProjectSettings.json:
--------------------------------------------------------------------------------
1 | {"ProjectWatches":"{\"Value\":[]}","ProjectBreakpoints":"{\"Value\":{\"Main.xaml\":[{\"ConditionalExpression\":null,\"ActionExpression\":null,\"ExpectedHitCounter\":null,\"ShouldContinueAfterAction\":false,\"IsEnabled\":true,\"ActivityIdRef\":\"Delete_1\",\"ActivityId\":\"1.12\",\"ActivityName\":\"Delete\"},{\"ConditionalExpression\":null,\"ActionExpression\":null,\"ExpectedHitCounter\":null,\"ShouldContinueAfterAction\":false,\"IsEnabled\":true,\"ActivityIdRef\":\"AddDataRow_1\",\"ActivityId\":\"1.22\",\"ActivityName\":\"Add Data Row\"}]}}","OpenedDocuments":"[\"Main.xaml\"]"}
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.local/db/references.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_08/NetCode27Process/.local/db/references.db
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.local/nuget.cache.backup:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "dgSpecHash": "uZe8TumqRuBAMG+j5G9kp4tYgADi3qjzrZSevp443iOaoj+xNLKbHa+RLPl0vsEemEPuHJGo1yObf2lv7kLDiA==",
4 | "success": true
5 | }
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.objects/.metadata:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "un1eGjy9NkmxwcSg9H0FQw",
3 | "Type": "Library",
4 | "Created": "2020-07-30T00:57:04.5275316Z",
5 | "CreatedBy": [
6 | "UiPath.Platform, Version=20.4.0.0, Culture=neutral, PublicKeyToken=null"
7 | ],
8 | "Updated": "2020-07-30T00:57:04.5275316Z"
9 | }
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.objects/.type:
--------------------------------------------------------------------------------
1 | Library
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.screenshots/7691dab2fb748d742f181a89fa1ace29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_08/NetCode27Process/.screenshots/7691dab2fb748d742f181a89fa1ace29.png
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.screenshots/bab26a320aa344c86a71b1a74fb56e55.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_08/NetCode27Process/.screenshots/bab26a320aa344c86a71b1a74fb56e55.png
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/.screenshots/cdcaca6a4f2bf6b540a89e7a7f90e102.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_08/NetCode27Process/.screenshots/cdcaca6a4f2bf6b540a89e7a7f90e102.png
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/Archivos/consultaCompras.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_08/NetCode27Process/Archivos/consultaCompras.xlsx
--------------------------------------------------------------------------------
/sesiones/sesion_08/NetCode27Process/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "NetCode27Process",
3 | "description": "Blank Process",
4 | "main": "Main.xaml",
5 | "dependencies": {
6 | "UiPath.Database.Activities": "[1.3.7369.25200]",
7 | "UiPath.Excel.Activities": "[2.9.0-preview]",
8 | "UiPath.Mail.Activities": "[1.9.0-preview]",
9 | "UiPath.PDF.Activities": "[3.2.2]",
10 | "UiPath.System.Activities": "[20.6.1-preview]",
11 | "UiPath.UIAutomation.Activities": "[20.6.0-preview]"
12 | },
13 | "webServices": [],
14 | "entitiesStores": [],
15 | "schemaVersion": "4.0",
16 | "studioVersion": "20.6.0.0",
17 | "projectVersion": "1.0.0",
18 | "runtimeOptions": {
19 | "autoDispose": false,
20 | "isPausable": true,
21 | "requiresUserInteraction": true,
22 | "supportsPersistence": false,
23 | "excludedLoggedData": [
24 | "Private:*",
25 | "*password*"
26 | ],
27 | "executionType": "Workflow"
28 | },
29 | "designOptions": {
30 | "projectProfile": "Developement",
31 | "outputType": "Process",
32 | "libraryOptions": {
33 | "includeOriginalXaml": false,
34 | "privateWorkflows": []
35 | },
36 | "fileInfoCollection": []
37 | },
38 | "expressionLanguage": "VisualBasic"
39 | }
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.local/ProjectSettings.json:
--------------------------------------------------------------------------------
1 | {"ProjectBreakpoints":"{\"Value\":{}}","ProjectWatches":"{\"Value\":[]}","LibraryProjectSettings":"{\"IncludeSourcesByDefault\":true,\"UseCompilerV2\":false,\"CompileExpressions\":false,\"DefaultActivitiesRootCategories\":[null]}","OpenedDocuments":"[\"Tests/RunAllTests.xaml\"]"}
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.local/db/references.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/.local/db/references.db
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.local/nuget.cache.backup:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "dgSpecHash": "EBQEXH3F5PnXZEMXK/Gslo0/AVLHz3AXTv5DlEPhUeImgqlqUZ0qlbVqXbpC/zyMBctiKwo5Mrm7XCfSnPnIbA==",
4 | "success": true
5 | }
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.objects/.metadata:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "hxTlpf1uoUKlP9Z_J6j7lQ",
3 | "Type": "Library",
4 | "Created": "2020-08-06T01:04:23.9896936Z",
5 | "CreatedBy": [
6 | "UiPath.Platform, Version=20.4.0.0, Culture=neutral, PublicKeyToken=null"
7 | ],
8 | "Updated": "2020-08-06T01:04:23.9896936Z"
9 | }
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.objects/.type:
--------------------------------------------------------------------------------
1 | Library
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.screenshots/33dde57b4ed0aa763b9311574b6c13b4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/.screenshots/33dde57b4ed0aa763b9311574b6c13b4.png
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.screenshots/3a2c3aad932f78210607d9644739347a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/.screenshots/3a2c3aad932f78210607d9644739347a.png
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/.screenshots/924f187ca2db1c3388a48272c1c9c985.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/.screenshots/924f187ca2db1c3388a48272c1c9c985.png
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Data/Config.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/Data/Config.xlsx
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Data/Input/placeholder.txt:
--------------------------------------------------------------------------------
1 | Input folder should be used to store all input files of the process.
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Data/Output/placeholder.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Data/ReporteNet.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/Data/ReporteNet.xlsx
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Data/Temp/placeholder.txt:
--------------------------------------------------------------------------------
1 | Temp folder should store the files while they are being processed. Once the processing part is done, the files should be removed from this folder.
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Exceptions_Screenshots/placeholder.txt:
--------------------------------------------------------------------------------
1 | When a System Error is thrown in the process, a screenshot is taken and saved to Exception_Screenshots folder.
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Tests/TestLog.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/Tests/Tests.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_09/REFNetCode27/Tests/Tests.xlsx
--------------------------------------------------------------------------------
/sesiones/sesion_09/REFNetCode27/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "REFNetCode27",
3 | "description": "Robotic Enterprise Framework",
4 | "main": "Main.xaml",
5 | "dependencies": {
6 | "UiPath.Excel.Activities": "[2.9.0-preview]",
7 | "UiPath.System.Activities": "[20.6.1-preview]",
8 | "UiPath.UIAutomation.Activities": "[20.6.0-preview]"
9 | },
10 | "webServices": [],
11 | "entitiesStores": [],
12 | "schemaVersion": "4.0",
13 | "studioVersion": "20.6.0.0",
14 | "projectVersion": "1.0.1",
15 | "runtimeOptions": {
16 | "autoDispose": false,
17 | "isPausable": true,
18 | "requiresUserInteraction": true,
19 | "supportsPersistence": false,
20 | "excludedLoggedData": [
21 | "Private:*",
22 | "*password*"
23 | ],
24 | "executionType": "Workflow"
25 | },
26 | "designOptions": {
27 | "projectProfile": "Developement",
28 | "outputType": "Process",
29 | "libraryOptions": {
30 | "includeOriginalXaml": false,
31 | "privateWorkflows": []
32 | },
33 | "fileInfoCollection": []
34 | },
35 | "arguments": {
36 | "input": [
37 | {
38 | "name": "in_OrchestratorQueueName",
39 | "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
40 | "required": false,
41 | "hasDefault": false
42 | }
43 | ],
44 | "output": []
45 | },
46 | "expressionLanguage": "VisualBasic"
47 | }
--------------------------------------------------------------------------------
/sesiones/sesion_10/DataBase/NetCode27.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_10/DataBase/NetCode27.zip
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.Extensions.Logging;
8 | using MiPrimerAppWeb.Models;
9 |
10 | namespace MiPrimerAppWeb.Controllers
11 | {
12 | public class HomeController : Controller
13 | {
14 | private readonly ILogger _logger;
15 |
16 | public HomeController(ILogger logger)
17 | {
18 | _logger = logger;
19 | }
20 |
21 | public IActionResult Index()
22 | {
23 | return View();
24 | }
25 |
26 | public IActionResult Privacy()
27 | {
28 | return View();
29 | }
30 |
31 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
32 | public IActionResult Error()
33 | {
34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/MiPrimerAppWeb.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace MiPrimerAppWeb.Models
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Models/PersonaDTO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace MiPrimerAppWeb.Models
7 | {
8 | public class PersonaDTO
9 | {
10 | public int Id { get; set; }
11 | public string Nombre { get; set; }
12 | public string ApPaterno { get; set; }
13 | public string ApMaterno { get; set; }
14 | public int Edad { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Models/PersonaViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace MiPrimerAppWeb.Models
7 | {
8 | public class PersonaViewModel
9 | {
10 | public List personas { get; set; }
11 | public PersonaDTO persona { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace MiPrimerAppWeb
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:61792",
7 | "sslPort": 44344
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development",
16 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
17 | }
18 | },
19 | "MiPrimerAppWeb": {
20 | "commandName": "Project",
21 | "launchBrowser": true,
22 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
23 | "environmentVariables": {
24 | "ASPNETCORE_ENVIRONMENT": "Development",
25 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.HttpsPolicy;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using Microsoft.Extensions.Hosting;
11 |
12 | namespace MiPrimerAppWeb
13 | {
14 | public class Startup
15 | {
16 | public Startup(IConfiguration configuration)
17 | {
18 | Configuration = configuration;
19 | }
20 |
21 | public IConfiguration Configuration { get; }
22 |
23 | // This method gets called by the runtime. Use this method to add services to the container.
24 | public void ConfigureServices(IServiceCollection services)
25 | {
26 | services.AddControllersWithViews();
27 | }
28 |
29 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
31 | {
32 | if (env.IsDevelopment())
33 | {
34 | app.UseDeveloperExceptionPage();
35 | }
36 | else
37 | {
38 | app.UseExceptionHandler("/Home/Error");
39 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
40 | app.UseHsts();
41 | }
42 | app.UseHttpsRedirection();
43 | app.UseStaticFiles();
44 |
45 | app.UseRouting();
46 |
47 | app.UseAuthorization();
48 |
49 | app.UseEndpoints(endpoints =>
50 | {
51 | endpoints.MapControllerRoute(
52 | name: "default",
53 | pattern: "{controller=Home}/{action=Index}/{id?}");
54 | });
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Home Page";
3 | }
4 |
5 |
6 |
NetCode27
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Home/Privacy.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Privacy Policy";
3 | }
4 | @ViewData["Title"]
5 |
6 | Use this page to detail your site's privacy policy.
7 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Persona/Actualizar.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaDTO
2 |
3 | @{
4 | ViewData["Title"] = "Actualizar";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 | Actualizar
9 |
10 | PersonaDTO
11 |
12 |
47 |
48 |
51 |
52 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Persona/Buscar.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaViewModel
2 | @{
3 | ViewData["Title"] = "Buscar";
4 | Layout = "~/Views/Shared/_Layout.cshtml";
5 | }
6 |
7 | Buscar
8 |
9 |
10 |
11 |
12 |
13 | @using (Html.BeginForm())
14 | {
15 |
16 | Id:
17 |
18 | Introduzca un ID.
19 |
20 |
21 |
Buscar
22 | }
23 |
24 |
25 |
26 | @if (Model.persona != null)
27 | {
28 |
Resultado:
29 |
30 |
59 | }
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Persona/Crear.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaDTO
2 |
3 | @{
4 | ViewData["Title"] = "Crear";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 | Crear Persona
9 |
10 |
11 |
46 |
47 |
50 |
51 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Persona/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model MiPrimerAppWeb.Models.PersonaViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Index";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 | Lista de Personas
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Id
17 | Nombre
18 | Apellido Paterno
19 | Apellido Materno
20 | Edad
21 | Eliminar
22 | Actualizar
23 |
24 |
25 |
26 | @foreach (var item in Model.personas)
27 | {
28 |
29 | @item.Id
30 | @item.Nombre
31 | @item.ApPaterno
32 | @item.ApMaterno
33 | @item.Edad
34 | @Html.ActionLink("Eliminar", "Eliminar", new { id = item.Id })
35 | @Html.ActionLink("Actualizar", "Actualizar", item)
36 |
37 | }
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewData["Title"] - MiPrimerAppWeb
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Inicio
15 |
17 |
18 |
19 |
40 |
41 |
42 |
43 |
44 |
45 | @RenderBody()
46 |
47 |
48 |
49 |
54 |
55 |
56 |
57 | @RenderSection("Scripts", required: false)
58 |
59 |
60 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using MiPrimerAppWeb
2 | @using MiPrimerAppWeb.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/assets/Logo_NetCode27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/assets/Logo_NetCode27.png
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | for details on configuring this project to bundle and minify static web assets. */
3 |
4 | a.navbar-brand {
5 | white-space: normal;
6 | text-align: center;
7 | word-break: break-all;
8 | }
9 |
10 | /* Provide sufficient contrast against white background */
11 | a {
12 | color: #0366d6;
13 | }
14 |
15 | .btn-primary {
16 | color: #fff;
17 | background-color: #1b6ec2;
18 | border-color: #1861ac;
19 | }
20 |
21 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link {
22 | color: #fff;
23 | background-color: #1b6ec2;
24 | border-color: #1861ac;
25 | }
26 |
27 | /* Sticky footer styles
28 | -------------------------------------------------- */
29 | html {
30 | font-size: 14px;
31 | }
32 | @media (min-width: 768px) {
33 | html {
34 | font-size: 16px;
35 | }
36 | }
37 |
38 | .border-top {
39 | border-top: 1px solid #e5e5e5;
40 | }
41 | .border-bottom {
42 | border-bottom: 1px solid #e5e5e5;
43 | }
44 |
45 | .box-shadow {
46 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
47 | }
48 |
49 | button.accept-policy {
50 | font-size: 1rem;
51 | line-height: inherit;
52 | }
53 |
54 | /* Sticky footer styles
55 | -------------------------------------------------- */
56 | html {
57 | position: relative;
58 | min-height: 100%;
59 | }
60 |
61 | body {
62 | /* Margin bottom by footer height */
63 | margin-bottom: 60px;
64 | }
65 | .footer {
66 | position: absolute;
67 | bottom: 0;
68 | width: 100%;
69 | white-space: nowrap;
70 | line-height: 60px; /* Vertically center the text there */
71 | }
72 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | // for details on configuring this project to bundle and minify static web assets.
3 |
4 | // Write your JavaScript code.
5 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2018 Twitter, Inc.
4 | Copyright (c) 2011-2018 The Bootstrap Authors
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .NET Foundation. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | these files except in compliance with the License. You may obtain a copy of the
5 | License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed
10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 | specific language governing permissions and limitations under the License.
13 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/MiPrimerAppWeb/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright JS Foundation and other contributors, https://js.foundation/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30104.148
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPINetCode27", "WebAPINetCode27\WebAPINetCode27.csproj", "{D304A2C8-54F9-4A69-9C30-51F76278D234}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiPrimerAppWeb", "MiPrimerAppWeb\MiPrimerAppWeb.csproj", "{CD6C347A-07B0-425B-996E-5486B221F02A}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {D304A2C8-54F9-4A69-9C30-51F76278D234}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {CD6C347A-07B0-425B-996E-5486B221F02A}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {00F1CCC2-19F3-4BA4-AF91-A2BB8856A06E}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "dotnet-ef": {
6 | "version": "3.1.5",
7 | "commands": [
8 | "dotnet-ef"
9 | ]
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Controllers/WeatherForecastController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.Extensions.Logging;
7 |
8 | namespace WebAPINetCode27.Controllers
9 | {
10 | [ApiController]
11 | [Route("[controller]")]
12 | public class WeatherForecastController : ControllerBase
13 | {
14 | private static readonly string[] Summaries = new[]
15 | {
16 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
17 | };
18 |
19 | private readonly ILogger _logger;
20 |
21 | public WeatherForecastController(ILogger logger)
22 | {
23 | _logger = logger;
24 | }
25 |
26 | [HttpGet]
27 | public IEnumerable Get()
28 | {
29 | var rng = new Random();
30 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
31 | {
32 | Date = DateTime.Now.AddDays(index),
33 | TemperatureC = rng.Next(-20, 55),
34 | Summary = Summaries[rng.Next(Summaries.Length)]
35 | })
36 | .ToArray();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/CorsAuthorizationFilterFactory.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc.Filters;
2 |
3 | namespace WebAPINetCode27
4 | {
5 | internal class CorsAuthorizationFilterFactory : IFilterMetadata
6 | {
7 | private string v;
8 |
9 | public CorsAuthorizationFilterFactory(string v)
10 | {
11 | this.v = v;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Model/LoginDTO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace WebAPINetCode27.Model
7 | {
8 | public class LoginDTO
9 | {
10 | public string Usuario { get; set; }
11 | public string Password { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Model/PersonaDTO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace WebAPINetCode27.Model
7 | {
8 | public class PersonaDTO
9 | {
10 | public int Id { get; set; }
11 | public string Nombre { get; set; }
12 | public string ApPaterno { get; set; }
13 | public string ApMaterno { get; set; }
14 | public int Edad { get; set; }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Model/UsuarioDTO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace WebAPINetCode27.Model
7 | {
8 | public class UsuarioDTO
9 | {
10 | public Guid Id { get; set; }
11 | public string Nombre { get; set; }
12 | public string Apellidos { get; set; }
13 | public string Email { get; set; }
14 | public string Rol { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/ModelDB/NetCode27Context.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata;
4 |
5 | namespace WebAPINetCode27.ModelDB
6 | {
7 | public partial class NetCode27Context : DbContext
8 | {
9 | public NetCode27Context()
10 | {
11 | }
12 |
13 | public NetCode27Context(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | public virtual DbSet Personas { get; set; }
19 |
20 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
21 | {
22 | if (!optionsBuilder.IsConfigured)
23 | {
24 | optionsBuilder.UseSqlServer("Server=tcp:netcode27.database.windows.net,1433;Initial Catalog=netcode27;Persist Security Info=False;User ID=netcode;Password=Villahermosa2020;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
25 |
26 | }
27 | }
28 |
29 | protected override void OnModelCreating(ModelBuilder modelBuilder)
30 | {
31 | modelBuilder.Entity(entity =>
32 | {
33 | entity.Property(e => e.ApMaterno).IsRequired();
34 |
35 | entity.Property(e => e.ApPaterno).IsRequired();
36 |
37 | entity.Property(e => e.Nombre).IsRequired();
38 | });
39 |
40 | OnModelCreatingPartial(modelBuilder);
41 | }
42 |
43 | partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/ModelDB/Personas.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace WebAPINetCode27.ModelDB
5 | {
6 | public partial class Personas
7 | {
8 | public int Id { get; set; }
9 | public string Nombre { get; set; }
10 | public string ApPaterno { get; set; }
11 | public string ApMaterno { get; set; }
12 | public int Edad { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace WebAPINetCode27
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:58723",
8 | "sslPort": 44314
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "weatherforecast",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "WebAPINetCode27": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "weatherforecast",
24 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/Startup.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/noriammx/netcode27/4d6283fb6c6f424503d7f71f7647578cd6a3866d/sesiones/sesion_10/WebAPINetCode27/Startup.cs
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WebAPINetCode27
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/WebAPINetCode27.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | all
14 | runtime; build; native; contentfiles; analyzers; buildtransitive
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/sesiones/sesion_10/WebAPINetCode27/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "JWT": {
3 | "secret": "\"NetCode27y3y3\"#$\"#$\"",
4 | "Issuer": "www.netcode27.com",
5 | "Audience": "www.netcode27.com/api/"
6 | },
7 |
8 |
9 | "Logging": {
10 | "LogLevel": {
11 | "Default": "Information",
12 | "Microsoft": "Warning",
13 | "Microsoft.Hosting.Lifetime": "Information"
14 | }
15 | },
16 | "AllowedHosts": "*"
17 | }
18 |
--------------------------------------------------------------------------------