Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emanuele Edmondo #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ToDoList/ToDoList/Attivia.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ToDoList.Generics.Entities
{
public class Attivita
{
public int Key { get; set; }
public string Descrizione { get; set; }
}
}
8 changes: 8 additions & 0 deletions ToDoList/ToDoList/Attivita.cs/Attivita.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ToDoList.Generics.Entities
{
public class Attivita
{
public int Key { get; set; }
public string Descrizione { get; set; }
}
}
10 changes: 10 additions & 0 deletions ToDoList/ToDoList/Attivita.cs/Attivita.cs.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"format": 1,
"restore": {
"C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj": {}
},
"projects": {
"C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj",
"projectName": "Attivita.cs",
"projectPath": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj",
"packagesPath": "C:\\Users\\emanu\\.nuget\\packages\\",
"outputPath": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\emanu\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.200\\RuntimeIdentifierGraph.json"
}
}
}
}
}
15 changes: 15 additions & 0 deletions ToDoList/ToDoList/Attivita.cs/obj/Attivita.cs.csproj.nuget.g.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\emanu\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\emanu\.nuget\packages\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("Attivita.cs")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Attivita.cs")]
[assembly: System.Reflection.AssemblyTitleAttribute("Attivita.cs")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
82a0fdb4c783410252a8b23a308ddf30b41c1dc759952b48ccd88645a5bab561
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Attivita.cs
build_property.ProjectDir = C:\Users\emanu\OneDrive\Desktop\ITSAPULIA\TestAPULIA\ToDoList\ToDoList\Attivita.cs\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("Attivita.cs")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Attivita.cs")]
[assembly: System.Reflection.AssemblyTitleAttribute("Attivita.cs")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0bd0159dfab93fb5e0bfb873c05a8a92d25acc75e46c02b76cf39b076d6ed287
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Attivita.cs
build_property.ProjectDir = C:\Users\emanu\OneDrive\Desktop\ITSAPULIA\TestAPULIA\ToDoList\ToDoList\Attivita.cs\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
Binary file not shown.
73 changes: 73 additions & 0 deletions ToDoList/ToDoList/Attivita.cs/obj/project.assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"version": 3,
"targets": {
"net6.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net6.0": []
},
"packageFolders": {
"C:\\Users\\emanu\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj",
"projectName": "Attivita.cs",
"projectPath": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj",
"packagesPath": "C:\\Users\\emanu\\.nuget\\packages\\",
"outputPath": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\emanu\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.200\\RuntimeIdentifierGraph.json"
}
}
}
}
8 changes: 8 additions & 0 deletions ToDoList/ToDoList/Attivita.cs/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "Oo/FFypJAlE4+rVTDPe1tcbiqXH3aHG9MsUXrFiHoSE24Jfn4HgTNa7jZ0SsQ8P7ZH/zIhqJAquXXb7cTfiJsQ==",
"success": true,
"projectFilePath": "C:\\Users\\emanu\\source\\repos\\ToDoList\\Attivita.cs\\Attivita.cs.csproj",
"expectedPackageFiles": [],
"logs": []
}
57 changes: 57 additions & 0 deletions ToDoList/ToDoList/AttivitaRepositori.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ToDoList.Generics.Entities;
using ToDoList.Generics.Interfaces;

namespace ToDoList.Generics.Repository
{
public class AttivitaRepository : ICrud<Attivita>
{
private List<Attivita> attivitaList = new List<Attivita>();
private int nextKey = 1;

public Attivita Create(Attivita item)
{
item.Key = nextKey++;
attivitaList.Add(item);
return item;
}

public Attivita GetById(int key)
{
return attivitaList.FirstOrDefault(a => a.Key == key);
}

public bool Update(Attivita item)
{
var existingAttivita = GetById(item.Key);
if (existingAttivita != null)
{
existingAttivita.Descrizione = item.Descrizione;
return true;
}
return false;
}

public bool Delete(int key)
{
var attivita = GetById(key);
if (attivita == null)
return false;

attivitaList.Remove(attivita);
return true;
}

public List<Attivita> GetAll()
{
return attivitaList;
}

public void Print(string message)
{
Console.WriteLine(message);
}
}
}
Loading