diff --git a/Hort Daniel/L01/README.md b/Hort Daniel/L01/README.md new file mode 100644 index 00000000..f72d7187 --- /dev/null +++ b/Hort Daniel/L01/README.md @@ -0,0 +1,6 @@ +L01 SaaS +======== +**Youtube** e un serviciu de distribuire de continut video-audio +care se incadreaza la definitia unui SaaS deoarece ai nevoie +doar de un cont de utilizator si eventual de un cont in banca +daca nu iti plac reclamele si nu ai auzit inca de AdBlock. diff --git a/Hort Daniel/L02/.dockerignore b/Hort Daniel/L02/.dockerignore new file mode 100644 index 00000000..3729ff0c --- /dev/null +++ b/Hort Daniel/L02/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Hort Daniel/L02/L02.sln b/Hort Daniel/L02/L02.sln new file mode 100644 index 00000000..a16da48c --- /dev/null +++ b/Hort Daniel/L02/L02.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31613.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L02", "L02\L02.csproj", "{A771835E-F29E-43FB-9C31-2A15D769AFAC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A771835E-F29E-43FB-9C31-2A15D769AFAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A771835E-F29E-43FB-9C31-2A15D769AFAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A771835E-F29E-43FB-9C31-2A15D769AFAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A771835E-F29E-43FB-9C31-2A15D769AFAC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0395D628-F9CD-4BC9-A420-D3C21FBE0B0B} + EndGlobalSection +EndGlobal diff --git a/Hort Daniel/L02/L02/Controllers/StudentsController.cs b/Hort Daniel/L02/L02/Controllers/StudentsController.cs new file mode 100644 index 00000000..3bb2671a --- /dev/null +++ b/Hort Daniel/L02/L02/Controllers/StudentsController.cs @@ -0,0 +1,56 @@ +using L02.Models; +using L02.Services; +using LanguageExt; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace L02.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class StudentsController : ControllerBase + { + private readonly StudentRepo repo; + + public StudentsController(StudentRepo repo) + { + this.repo = repo; + } + + [HttpGet] + public async Task Get() + => Ok(repo.Get()); + + [HttpGet("{id}")] + public async Task Get( + [FromRoute] int id) + => repo.Get(a => a.Id == a.Id).Case switch + { + SomeCase s => Ok(s.Value), + NoneCase _ => NotFound() + }; + + [HttpPost] + public async Task Add( + [FromBody] Student student) + => repo.Add(student) switch + { + true => Ok(), + false => BadRequest($"Student with id:{{{student.Id}}} already exists.") + }; + + [HttpPut] + public async Task Update( + [FromBody] Student student) + => Ok(repo.Update(student)); + + [HttpDelete("{id}")] + public async Task Delete( + [FromRoute] int id) + => Ok(repo.Delete(a => a.Id == id)); + } +} diff --git a/Hort Daniel/L02/L02/Dockerfile b/Hort Daniel/L02/L02/Dockerfile new file mode 100644 index 00000000..1aa11e6e --- /dev/null +++ b/Hort Daniel/L02/L02/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["L02/L02.csproj", "L02/"] +RUN dotnet restore "L02/L02.csproj" +COPY . . +WORKDIR "/src/L02" +RUN dotnet build "L02.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "L02.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "L02.dll"] \ No newline at end of file diff --git a/Hort Daniel/L02/L02/L02.csproj b/Hort Daniel/L02/L02/L02.csproj new file mode 100644 index 00000000..b9d83f22 --- /dev/null +++ b/Hort Daniel/L02/L02/L02.csproj @@ -0,0 +1,15 @@ + + + + net5.0 + af3dfcca-cb4f-4bbc-876b-df1e6d46321d + Linux + + + + + + + + + diff --git a/Hort Daniel/L02/L02/Models/Student.cs b/Hort Daniel/L02/L02/Models/Student.cs new file mode 100644 index 00000000..e389ecfb --- /dev/null +++ b/Hort Daniel/L02/L02/Models/Student.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace L02.Models +{ + public class Student + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Faculty { get; set; } + public int YearOfStudy { get; set; } + } +} diff --git a/Hort Daniel/L02/L02/Program.cs b/Hort Daniel/L02/L02/Program.cs new file mode 100644 index 00000000..da448d8e --- /dev/null +++ b/Hort Daniel/L02/L02/Program.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace L02 +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/Hort Daniel/L02/L02/Properties/launchSettings.json b/Hort Daniel/L02/L02/Properties/launchSettings.json new file mode 100644 index 00000000..814b9bc4 --- /dev/null +++ b/Hort Daniel/L02/L02/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:1879", + "sslPort": 44301 + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "L02": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": "true", + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/Hort Daniel/L02/L02/Services/StudentRepo.cs b/Hort Daniel/L02/L02/Services/StudentRepo.cs new file mode 100644 index 00000000..95eecd9e --- /dev/null +++ b/Hort Daniel/L02/L02/Services/StudentRepo.cs @@ -0,0 +1,47 @@ +using L02.Models; +using LanguageExt; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace L02.Services +{ + public class StudentRepo + { + private IEnumerable students; + + public StudentRepo() + { + students = Enumerable.Empty(); + } + + public Option Get(Func predicate) + => students.FirstOrDefault(predicate); + + public IEnumerable Get() + => students.OrderBy(a => a.Id); + + public bool Add(Student student) + { + var exists = students.Any(a => a.Id == student.Id); + if (exists) + return false; + students = students.Append(student); + return true; + } + + public Unit Update(Student student) + { + students = students.Where(a => a.Id != student.Id).Append(student); + return Unit.Default; + } + + public Unit Delete(Func predicate) + { + students = students.Where(a => !predicate.Invoke(a)); + return Unit.Default; + } + } +} diff --git a/Hort Daniel/L02/L02/Startup.cs b/Hort Daniel/L02/L02/Startup.cs new file mode 100644 index 00000000..ec98bd36 --- /dev/null +++ b/Hort Daniel/L02/L02/Startup.cs @@ -0,0 +1,60 @@ +using L02.Services; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace L02 +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddSingleton(a => new StudentRepo()); + services.AddControllers(); + services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "L02", Version = "v1" }); + }); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + //if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "L02 v1")); + } + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/Hort Daniel/L02/L02/appsettings.Development.json b/Hort Daniel/L02/L02/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/Hort Daniel/L02/L02/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/Hort Daniel/L02/L02/appsettings.json b/Hort Daniel/L02/L02/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/Hort Daniel/L02/L02/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/Hort Daniel/L03/L03.sln b/Hort Daniel/L03/L03.sln new file mode 100644 index 00000000..5ebc79fd --- /dev/null +++ b/Hort Daniel/L03/L03.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31613.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L03", "L03\L03.csproj", "{3841303C-4C25-4823-B190-D45BCFF2CC73}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3841303C-4C25-4823-B190-D45BCFF2CC73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3841303C-4C25-4823-B190-D45BCFF2CC73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3841303C-4C25-4823-B190-D45BCFF2CC73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3841303C-4C25-4823-B190-D45BCFF2CC73}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AFDE35EE-8925-480A-82F2-83EC86839376} + EndGlobalSection +EndGlobal diff --git a/Hort Daniel/L03/L03/L03.csproj b/Hort Daniel/L03/L03/L03.csproj new file mode 100644 index 00000000..9b82f441 --- /dev/null +++ b/Hort Daniel/L03/L03/L03.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + diff --git a/Hort Daniel/L03/L03/Program.cs b/Hort Daniel/L03/L03/Program.cs new file mode 100644 index 00000000..f8cb63fb --- /dev/null +++ b/Hort Daniel/L03/L03/Program.cs @@ -0,0 +1,57 @@ +using Google.Apis.Auth.OAuth2; +using Google.Apis.Drive.v3; +using Google.Apis.Services; +using Google.Apis.Util.Store; +using Newtonsoft.Json; +using System; +using System.IO; +using System.Linq; +using System.Net.Mime; +using System.Threading; +using System.Threading.Tasks; + +namespace L03 +{ + class Program + { + static async Task Main(string[] args) + { + var clientId = "5360745208-qd3487llarraa0fm0eggmne1trsbjcqu.apps.googleusercontent.com"; + var clientSecret = "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"; + + var clientSecrets = new ClientSecrets() { ClientId = clientId, ClientSecret = clientSecret }; + var scopes = Enumerable.Empty() + .Append(DriveService.Scope.Drive) + .Append(DriveService.Scope.DriveFile); + + var creds = await GoogleWebAuthorizationBroker.AuthorizeAsync( + clientSecrets, scopes, Environment.UserName, CancellationToken.None, + new FileDataStore("Daimto.GoogleDrive.Auth.Store")); + using var service = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = creds }); + + var fileListRequest = service.Files.List(); + fileListRequest.Fields = "nextPageToken, files(id, name, fileExtension, mimeType, size)"; + fileListRequest.Q = "'root' in parents and mimeType != 'application/vnd.google-apps.folder'"; + fileListRequest.OrderBy = "name"; + + var data = await fileListRequest.ExecuteAsync(); + Console.WriteLine(data.Files + .Select(a => $"{a.Name}\n") + .Aggregate((a, b) => a + b)); + + using var stream = new MemoryStream(); + using var writer = new StreamWriter(stream); + writer.WriteLine("random"); + writer.Flush(); + stream.Position = 0; + + var file = new Google.Apis.Drive.v3.Data.File(); + file.Name = "random.txt"; + file.Description = "Mami, pot sa ma joc un pic cu baietii?"; + file.MimeType = MediaTypeNames.Text.Plain; + file.Parents = new string[] { "root" }; + var fileCreateRequest = service.Files.Create(file, stream, MediaTypeNames.Text.Plain); + await fileCreateRequest.UploadAsync(); + } + } +} diff --git a/Hort Daniel/L04/.dockerignore b/Hort Daniel/L04/.dockerignore new file mode 100644 index 00000000..3729ff0c --- /dev/null +++ b/Hort Daniel/L04/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Hort Daniel/L04/.editorconfig b/Hort Daniel/L04/.editorconfig new file mode 100644 index 00000000..8d2a1fce --- /dev/null +++ b/Hort Daniel/L04/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. +dotnet_diagnostic.CS8618.severity = none diff --git a/Hort Daniel/L04/L04.sln b/Hort Daniel/L04/L04.sln new file mode 100644 index 00000000..ceea3a0c --- /dev/null +++ b/Hort Daniel/L04/L04.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31808.319 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L04", "L04\L04.csproj", "{6559B64C-32D3-4EB4-A01F-62A1A1338D89}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5FE4C0F0-4301-4E20-ADE6-FC6BC69D506F}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6559B64C-32D3-4EB4-A01F-62A1A1338D89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6559B64C-32D3-4EB4-A01F-62A1A1338D89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6559B64C-32D3-4EB4-A01F-62A1A1338D89}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6559B64C-32D3-4EB4-A01F-62A1A1338D89}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5AD2A9F8-21FE-48DC-A620-D72848A0EB1B} + EndGlobalSection +EndGlobal diff --git a/Hort Daniel/L04/L04/AzureStorageAccountSettings.cs b/Hort Daniel/L04/L04/AzureStorageAccountSettings.cs new file mode 100644 index 00000000..3d42bee5 --- /dev/null +++ b/Hort Daniel/L04/L04/AzureStorageAccountSettings.cs @@ -0,0 +1,9 @@ +namespace L04; + +public class AzureStorageAccountSettings +{ + public string AccountName { get; set; } + public string ConnectionString { get; set; } + public string StorageAccountKey { get; set; } + public string StorageUri => $"https://{AccountName}.table.core.windows.net/"; +} diff --git a/Hort Daniel/L04/L04/Controllers/StudentsController.cs b/Hort Daniel/L04/L04/Controllers/StudentsController.cs new file mode 100644 index 00000000..786e0c8b --- /dev/null +++ b/Hort Daniel/L04/L04/Controllers/StudentsController.cs @@ -0,0 +1,45 @@ +using Microsoft.AspNetCore.Mvc; + +namespace L04.Controllers; + +[Route("api/[controller]/[action]")] +[ApiController] +public class StudentsController : ControllerBase +{ + private readonly StudentsService _studentService; + + public StudentsController(StudentsService studentService) + { + _studentService = studentService; + } + + [HttpGet] + public async Task GetAll() + => Ok(await _studentService.GetAll()); + + [HttpGet("{university}/{id}")] + public async Task Get([FromRoute] string university, string id) + => await _studentService.Get(university.Trim(), id.Trim()).Match( + student => Ok(student), + exception => (IActionResult)NotFound()); + + [HttpPost] + public async Task Add([FromBody] StudentEntity student) + => (await _studentService.Add(student)).GetRawResponse().Status switch + { + 201 => Ok(), + _ => BadRequest() + }; + + [HttpPut] + public async Task Edit([FromBody] StudentEntity student) + => await _studentService.Edit(student).Match( + unit => Ok(), + exception => (IActionResult)BadRequest()); + + [HttpDelete("{university}/{id}")] + public async Task Delete([FromRoute]string university, string id) + => await _studentService.Delete(university.Trim(), id.Trim()).Match( + unit => Ok(), + exception => (IActionResult)BadRequest()); +} diff --git a/Hort Daniel/L04/L04/Dockerfile b/Hort Daniel/L04/L04/Dockerfile new file mode 100644 index 00000000..08a1138c --- /dev/null +++ b/Hort Daniel/L04/L04/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["L04/L04.csproj", "L04/"] +RUN dotnet restore "L04/L04.csproj" +COPY . . +WORKDIR "/src/L04" +RUN dotnet build "L04.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "L04.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "L04.dll"] \ No newline at end of file diff --git a/Hort Daniel/L04/L04/Extensions.cs b/Hort Daniel/L04/L04/Extensions.cs new file mode 100644 index 00000000..1c3701d1 --- /dev/null +++ b/Hort Daniel/L04/L04/Extensions.cs @@ -0,0 +1,19 @@ +using Azure; +using Azure.Data.Tables; + +namespace L04; + +public static class Extensions +{ + public static async Task> AsEnumerable(this AsyncPageable result) + where T : ITableEntity + { + var list = Enumerable.Empty(); + await foreach (var item in result) + { + list = list.Append(item); + } + + return list; + } +} diff --git a/Hort Daniel/L04/L04/L04.csproj b/Hort Daniel/L04/L04/L04.csproj new file mode 100644 index 00000000..a89214fd --- /dev/null +++ b/Hort Daniel/L04/L04/L04.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + enable + ece6e415-0b75-402b-af63-d2162522e7d9 + Linux + + + + + + + + + + + + + + + + diff --git a/Hort Daniel/L04/L04/Program.cs b/Hort Daniel/L04/L04/Program.cs new file mode 100644 index 00000000..0bf9cb95 --- /dev/null +++ b/Hort Daniel/L04/L04/Program.cs @@ -0,0 +1,32 @@ +using L04; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var azureStorageAccountSettings = new AzureStorageAccountSettings(); +builder.Configuration.Bind(nameof(AzureStorageAccountSettings), azureStorageAccountSettings); +builder.Services.AddSingleton(azureStorageAccountSettings); +builder.Services.AddSingleton(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +//if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/Hort Daniel/L04/L04/Properties/launchSettings.json b/Hort Daniel/L04/L04/Properties/launchSettings.json new file mode 100644 index 00000000..7f243c69 --- /dev/null +++ b/Hort Daniel/L04/L04/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:20043", + "sslPort": 44329 + } + }, + "profiles": { + "L04": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:7088;http://localhost:5088", + "dotnetRunMessages": true + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/Hort Daniel/L04/L04/StudentEntity.cs b/Hort Daniel/L04/L04/StudentEntity.cs new file mode 100644 index 00000000..9578626e --- /dev/null +++ b/Hort Daniel/L04/L04/StudentEntity.cs @@ -0,0 +1,16 @@ +using Azure; +using Azure.Data.Tables; + +namespace L04; + +public class StudentEntity : ITableEntity +{ + public string PartitionKey { get; set; } + public string RowKey { get; set; } + public DateTimeOffset? Timestamp { get; set; } + public ETag ETag { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Faculty { get; set; } + public int YearOfStudy { get; set; } +} diff --git a/Hort Daniel/L04/L04/StudentsService.cs b/Hort Daniel/L04/L04/StudentsService.cs new file mode 100644 index 00000000..ef4814c3 --- /dev/null +++ b/Hort Daniel/L04/L04/StudentsService.cs @@ -0,0 +1,41 @@ +using Azure; +using Azure.Data.Tables; +using Azure.Storage.Queues; +using Azure.Storage.Queues.Models; +using LanguageExt; +using Newtonsoft.Json; +using System.Text; + +namespace L04; + +public class StudentsService +{ + private readonly AzureStorageAccountSettings _settings; + private readonly TableClient _client; + private readonly QueueClient _queueClient; + public StudentsService(AzureStorageAccountSettings settings) + { + _settings = settings; + _client = new TableClient(new Uri(_settings.StorageUri), "Students", + new TableSharedKeyCredential(_settings.AccountName, _settings.StorageAccountKey)); + _client.CreateIfNotExists(); + _queueClient = new QueueClient(_settings.ConnectionString, "datc6-queue", + new() { MessageEncoding = QueueMessageEncoding.Base64 }); + } + + public async Task> GetAll() + => await _client.QueryAsync().AsEnumerable(); + + public TryAsync Get(string partitionKey, string rowKey) + => async () => (await _client.GetEntityAsync(partitionKey, rowKey)).Value; + + public async Task> Add(StudentEntity student) + => await _queueClient.SendMessageAsync(JsonConvert.SerializeObject(student)); + //=> async () => await _client.AddEntityAsync(student).ToUnit(); + + public TryAsync Edit(StudentEntity student) + => async () => await _client.UpdateEntityAsync(student, student.ETag).ToUnit(); + + public TryAsync Delete(string partitionKey, string rowKey) + => async () => await _client.DeleteEntityAsync(partitionKey, rowKey).ToUnit(); +} diff --git a/Hort Daniel/L04/L04/appsettings.Development.json b/Hort Daniel/L04/L04/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/Hort Daniel/L04/L04/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Hort Daniel/L04/L04/appsettings.json b/Hort Daniel/L04/L04/appsettings.json new file mode 100644 index 00000000..0dffbfa6 --- /dev/null +++ b/Hort Daniel/L04/L04/appsettings.json @@ -0,0 +1,14 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "AzureStorageAccountSettings": { + "AccountName": "datcstorage", + "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=datcstorage;AccountKey=/2oP05/AHX/K6IND8XCpGMM8sjNfkSRsxpeFntOH8+D6xbTFU06hT2SCr7cmLatHvESlbCEuQHzFb8QzYZ2rhQ==;EndpointSuffix=core.windows.net", + "StorageAccountKey": "/2oP05/AHX/K6IND8XCpGMM8sjNfkSRsxpeFntOH8+D6xbTFU06hT2SCr7cmLatHvESlbCEuQHzFb8QzYZ2rhQ==" + } +} diff --git a/Hort Daniel/L05/.editorconfig b/Hort Daniel/L05/.editorconfig new file mode 100644 index 00000000..8d2a1fce --- /dev/null +++ b/Hort Daniel/L05/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. +dotnet_diagnostic.CS8618.severity = none diff --git a/Hort Daniel/L05/L05.sln b/Hort Daniel/L05/L05.sln new file mode 100644 index 00000000..56f2f9a9 --- /dev/null +++ b/Hort Daniel/L05/L05.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31808.319 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L05", "L05\L05.csproj", "{33649C03-0BDF-45B1-934D-6F82F0ECF03B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{58DF3961-C3EB-408F-B03D-6CB77986ABC8}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {33649C03-0BDF-45B1-934D-6F82F0ECF03B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33649C03-0BDF-45B1-934D-6F82F0ECF03B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33649C03-0BDF-45B1-934D-6F82F0ECF03B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33649C03-0BDF-45B1-934D-6F82F0ECF03B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D351AAB2-9B8D-4B19-BD42-DF2FEF7034B5} + EndGlobalSection +EndGlobal diff --git a/Hort Daniel/L05/L05/AzureStorageAccountSettings.cs b/Hort Daniel/L05/L05/AzureStorageAccountSettings.cs new file mode 100644 index 00000000..9cbceede --- /dev/null +++ b/Hort Daniel/L05/L05/AzureStorageAccountSettings.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace L05; + +public class AzureStorageAccountSettings +{ + public string AccountName => "datcstorage"; + public string ConnectionString => "DefaultEndpointsProtocol=https;AccountName=datcstorage;AccountKey=/2oP05/AHX/K6IND8XCpGMM8sjNfkSRsxpeFntOH8+D6xbTFU06hT2SCr7cmLatHvESlbCEuQHzFb8QzYZ2rhQ==;EndpointSuffix=core.windows.net"; + public string StorageAccountKey => "/2oP05/AHX/K6IND8XCpGMM8sjNfkSRsxpeFntOH8+D6xbTFU06hT2SCr7cmLatHvESlbCEuQHzFb8QzYZ2rhQ=="; + public string StorageUri => $"https://{AccountName}.table.core.windows.net/"; +} diff --git a/Hort Daniel/L05/L05/Extensions.cs b/Hort Daniel/L05/L05/Extensions.cs new file mode 100644 index 00000000..88247686 --- /dev/null +++ b/Hort Daniel/L05/L05/Extensions.cs @@ -0,0 +1,24 @@ +using Azure; +using Azure.Data.Tables; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace L05; + +public static class Extensions +{ + public static async Task> AsEnumerable(this AsyncPageable result) + where T : ITableEntity + { + var list = Enumerable.Empty(); + await foreach (var item in result) + { + list = list.Append(item); + } + + return list; + } +} diff --git a/Hort Daniel/L05/L05/L05.csproj b/Hort Daniel/L05/L05/L05.csproj new file mode 100644 index 00000000..7f58f61c --- /dev/null +++ b/Hort Daniel/L05/L05/L05.csproj @@ -0,0 +1,18 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + + + diff --git a/Hort Daniel/L05/L05/MetricEntity.cs b/Hort Daniel/L05/L05/MetricEntity.cs new file mode 100644 index 00000000..2ffe5c21 --- /dev/null +++ b/Hort Daniel/L05/L05/MetricEntity.cs @@ -0,0 +1,18 @@ +using Azure; +using Azure.Data.Tables; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace L05; + +public class MetricEntity : ITableEntity +{ + public string PartitionKey { get; set; } + public string RowKey { get; set; } + public DateTimeOffset? Timestamp { get; set; } + public ETag ETag { get; set; } + public int Count { get; set; } +} diff --git a/Hort Daniel/L05/L05/Program.cs b/Hort Daniel/L05/L05/Program.cs new file mode 100644 index 00000000..09ac47e8 --- /dev/null +++ b/Hort Daniel/L05/L05/Program.cs @@ -0,0 +1,29 @@ +using Azure.Data.Tables; +using L05; + +var settings = new AzureStorageAccountSettings(); + +var studentClient = new TableClient(new Uri(settings.StorageUri), "Students", + new TableSharedKeyCredential(settings.AccountName, settings.StorageAccountKey)); +var metricsClient = new TableClient(new Uri(settings.StorageUri), "Metrics", + new TableSharedKeyCredential(settings.AccountName, settings.StorageAccountKey)); +await metricsClient.CreateIfNotExistsAsync(); + +var students = await studentClient.QueryAsync().AsEnumerable(); + +var tasks = from university in students.Select(a => a.PartitionKey).Distinct() + let count = students.Where(a => a.PartitionKey == university).Count() + let metric = new MetricEntity() + { + PartitionKey = university, + RowKey = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"), + Count = count + } + select metricsClient.AddEntityAsync(metric); + +await Task.WhenAll(tasks.Append(metricsClient.AddEntityAsync(new MetricEntity() +{ + PartitionKey = "General", + RowKey = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"), + Count = students.Count() +}))); diff --git a/Hort Daniel/L05/L05/StudentEntity.cs b/Hort Daniel/L05/L05/StudentEntity.cs new file mode 100644 index 00000000..c337ad33 --- /dev/null +++ b/Hort Daniel/L05/L05/StudentEntity.cs @@ -0,0 +1,21 @@ +using Azure; +using Azure.Data.Tables; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace L05; + +public class StudentEntity : ITableEntity +{ + public string PartitionKey { get; set; } + public string RowKey { get; set; } + public DateTimeOffset? Timestamp { get; set; } + public ETag ETag { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Faculty { get; set; } + public int YearOfStudy { get; set; } +} diff --git a/Hort Daniel/L06/L06.sln b/Hort Daniel/L06/L06.sln new file mode 100644 index 00000000..ec835a9e --- /dev/null +++ b/Hort Daniel/L06/L06.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.31911.260 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L06", "L06\L06.csproj", "{539B0F47-FDA4-46C3-963D-2B1F03E08D43}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {539B0F47-FDA4-46C3-963D-2B1F03E08D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {539B0F47-FDA4-46C3-963D-2B1F03E08D43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {539B0F47-FDA4-46C3-963D-2B1F03E08D43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {539B0F47-FDA4-46C3-963D-2B1F03E08D43}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4828955C-AAD7-4987-A7E7-9F7899939D2B} + EndGlobalSection +EndGlobal diff --git a/Hort Daniel/L06/L06/.gitignore b/Hort Daniel/L06/L06/.gitignore new file mode 100644 index 00000000..ff5b00c5 --- /dev/null +++ b/Hort Daniel/L06/L06/.gitignore @@ -0,0 +1,264 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# Azure Functions localsettings file +local.settings.json + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/Hort Daniel/L06/L06/Function1.cs b/Hort Daniel/L06/L06/Function1.cs new file mode 100644 index 00000000..0a699229 --- /dev/null +++ b/Hort Daniel/L06/L06/Function1.cs @@ -0,0 +1,24 @@ +using System; +using Microsoft.Azure.Storage.Queue; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Host; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; + +namespace L06 +{ + public class Function1 + { + [FunctionName("Function1")] + [return: Table("Students", Connection = "DatcStorage")] + public StudentEntity Run([QueueTrigger("datc6-queue")] CloudQueueMessage message, ILogger log) + { + log.LogInformation($"New message: {message.AsString}"); + StudentEntity student = default; + try { student = JsonConvert.DeserializeObject(message.AsString); }catch { } + if (student is null) + log.LogWarning($"Could not deserialize message into StudentEntity"); + return student; + } + } +} diff --git a/Hort Daniel/L06/L06/L06.csproj b/Hort Daniel/L06/L06/L06.csproj new file mode 100644 index 00000000..6a8e434f --- /dev/null +++ b/Hort Daniel/L06/L06/L06.csproj @@ -0,0 +1,20 @@ + + + net6.0 + v4 + + + + + + + + + PreserveNewest + + + PreserveNewest + Never + + + diff --git a/Hort Daniel/L06/L06/Properties/serviceDependencies.json b/Hort Daniel/L06/L06/Properties/serviceDependencies.json new file mode 100644 index 00000000..df4dcc9d --- /dev/null +++ b/Hort Daniel/L06/L06/Properties/serviceDependencies.json @@ -0,0 +1,11 @@ +{ + "dependencies": { + "appInsights1": { + "type": "appInsights" + }, + "storage1": { + "type": "storage", + "connectionId": "AzureWebJobsStorage" + } + } +} \ No newline at end of file diff --git a/Hort Daniel/L06/L06/Properties/serviceDependencies.local.json b/Hort Daniel/L06/L06/Properties/serviceDependencies.local.json new file mode 100644 index 00000000..b804a289 --- /dev/null +++ b/Hort Daniel/L06/L06/Properties/serviceDependencies.local.json @@ -0,0 +1,11 @@ +{ + "dependencies": { + "appInsights1": { + "type": "appInsights.sdk" + }, + "storage1": { + "type": "storage.emulator", + "connectionId": "AzureWebJobsStorage" + } + } +} \ No newline at end of file diff --git a/Hort Daniel/L06/L06/StudentEntity.cs b/Hort Daniel/L06/L06/StudentEntity.cs new file mode 100644 index 00000000..ddd26727 --- /dev/null +++ b/Hort Daniel/L06/L06/StudentEntity.cs @@ -0,0 +1,11 @@ +namespace L06; + +public class StudentEntity +{ + public string PartitionKey { get; set; } + public string RowKey { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Faculty { get; set; } + public int YearOfStudy { get; set; } +} diff --git a/Hort Daniel/L06/L06/host.json b/Hort Daniel/L06/L06/host.json new file mode 100644 index 00000000..beb2e402 --- /dev/null +++ b/Hort Daniel/L06/L06/host.json @@ -0,0 +1,11 @@ +{ + "version": "2.0", + "logging": { + "applicationInsights": { + "samplingSettings": { + "isEnabled": true, + "excludedTypes": "Request" + } + } + } +} \ No newline at end of file diff --git a/Hort Daniel/L06/L06/settings.json b/Hort Daniel/L06/L06/settings.json new file mode 100644 index 00000000..8a0b7f07 --- /dev/null +++ b/Hort Daniel/L06/L06/settings.json @@ -0,0 +1,10 @@ +{ + "IsEncrypted": false, + "Values": { + "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=datcstorage;AccountKey=/2oP05/AHX/K6IND8XCpGMM8sjNfkSRsxpeFntOH8+D6xbTFU06hT2SCr7cmLatHvESlbCEuQHzFb8QzYZ2rhQ==;EndpointSuffix=core.windows.net", + "FUNCTIONS_WORKER_RUNTIME": "dotnet" + }, + "ConnectionStrings": { + "DatcStorage": "DefaultEndpointsProtocol=https;AccountName=datcstorage;AccountKey=/2oP05/AHX/K6IND8XCpGMM8sjNfkSRsxpeFntOH8+D6xbTFU06hT2SCr7cmLatHvESlbCEuQHzFb8QzYZ2rhQ==;EndpointSuffix=core.windows.net" + } +} \ No newline at end of file