diff --git a/RMData/RMData.refactorlog b/RMData/RMData.refactorlog
index 13da138..174f553 100644
--- a/RMData/RMData.refactorlog
+++ b/RMData/RMData.refactorlog
@@ -49,4 +49,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RMData/RMData.sqlproj b/RMData/RMData.sqlproj
index 1f0cb8e..5471387 100644
--- a/RMData/RMData.sqlproj
+++ b/RMData/RMData.sqlproj
@@ -71,6 +71,7 @@
+
diff --git a/RMData/dbo/Stored Procedures/spUserLookup.sql b/RMData/dbo/Stored Procedures/spUserLookup.sql
new file mode 100644
index 0000000..98e8356
--- /dev/null
+++ b/RMData/dbo/Stored Procedures/spUserLookup.sql
@@ -0,0 +1,10 @@
+CREATE PROCEDURE [dbo].[spUserLookup]
+ @Id nvarchar(128)
+AS
+BEGIN
+ SET NOCOUNT ON;
+
+ SELECT Id, FirstName, LastName, EmailAddress, CreatedDate
+ from [dbo].[User]
+ where Id = @Id
+END
diff --git a/RMData/dbo/Tables/Product.sql b/RMData/dbo/Tables/Product.sql
index 0b6095c..78867e4 100644
--- a/RMData/dbo/Tables/Product.sql
+++ b/RMData/dbo/Tables/Product.sql
@@ -4,7 +4,7 @@
[ProductName] NVARCHAR(100) NOT NULL,
[Description] NVARCHAR(MAX) NOT NULL,
[RetailPrice] MONEY NOT NULL,
- [CreateDate] DATETIME2 NOT NULL DEFAULT getutcdate(),
+ [CreatedDate] DATETIME2 NOT NULL DEFAULT getutcdate(),
[LastModified] DATETIME2 NOT NULL DEFAULT getutcdate(),
)
diff --git a/RMData/dbo/Tables/User.sql b/RMData/dbo/Tables/User.sql
index 7174bd4..256b1e8 100644
--- a/RMData/dbo/Tables/User.sql
+++ b/RMData/dbo/Tables/User.sql
@@ -4,5 +4,5 @@
[FirstName] NVARCHAR(50) NOT NULL,
[LastName] NVARCHAR(50) NOT NULL,
[EmailAddress] NVARCHAR(256) NOT NULL,
- [CreateDate] DATETIME2 NOT NULL DEFAULT getutcdate()
+ [CreatedDate] DATETIME2 NOT NULL DEFAULT getutcdate()
)
diff --git a/RMDataManager/Controllers/UserController.cs b/RMDataManager/Controllers/UserController.cs
new file mode 100644
index 0000000..fa2c241
--- /dev/null
+++ b/RMDataManager/Controllers/UserController.cs
@@ -0,0 +1,22 @@
+using RMDataManagerLibrary.DataAcccess;
+using System.Collections.Generic;
+using System.Web.Http;
+using RMDataManagerLibrary.Models;
+using System.Web;
+using Microsoft.AspNet.Identity;
+
+namespace RMDataManager.Controllers
+{
+ [Authorize]
+ public class UserController : ApiController
+ {
+ public List GetById()
+ {
+ string userId = RequestContext.Principal.Identity.GetUserId();
+
+ UserData data = new UserData();
+
+ return data.GetUserById(userId);
+ }
+ }
+}
diff --git a/RMDataManager/RMDataManager.csproj b/RMDataManager/RMDataManager.csproj
index 9a0e9d8..0611b47 100644
--- a/RMDataManager/RMDataManager.csproj
+++ b/RMDataManager/RMDataManager.csproj
@@ -213,6 +213,7 @@
+
Global.asax
@@ -283,6 +284,7 @@
+
@@ -313,6 +315,12 @@
+
+
+ {6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}
+ RMDataManagerLibrary
+
+
10.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
diff --git a/RMDataManager/Web.config b/RMDataManager/Web.config
index eff40fa..9529ec5 100644
--- a/RMDataManager/Web.config
+++ b/RMDataManager/Web.config
@@ -10,6 +10,7 @@
+
diff --git a/RMDataManagerLibrary/DataAcccess/UserData.cs b/RMDataManagerLibrary/DataAcccess/UserData.cs
new file mode 100644
index 0000000..7604045
--- /dev/null
+++ b/RMDataManagerLibrary/DataAcccess/UserData.cs
@@ -0,0 +1,24 @@
+using RMDataManagerLibrary.Internal.DataAccess;
+using RMDataManagerLibrary.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RMDataManagerLibrary.DataAcccess
+{
+ public class UserData
+ {
+ public List GetUserById(string Id)
+ {
+ SqlDataAccess sql = new SqlDataAccess();
+
+ var p = new { Id = Id };
+
+ var output = sql.LoadData("dbo.spUserLookup", p, "RMData");
+
+ return output;
+ }
+ }
+}
diff --git a/RMDataManagerLibrary/Internal/DataAccess/SqlDataAccess.cs b/RMDataManagerLibrary/Internal/DataAccess/SqlDataAccess.cs
new file mode 100644
index 0000000..be7fb87
--- /dev/null
+++ b/RMDataManagerLibrary/Internal/DataAccess/SqlDataAccess.cs
@@ -0,0 +1,44 @@
+using Dapper;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RMDataManagerLibrary.Internal.DataAccess
+{
+ public class SqlDataAccess
+ {
+ public string GetConnectionString(string name)
+ {
+ return ConfigurationManager.ConnectionStrings[name].ConnectionString;
+ }
+
+ public List LoadData(string storedProcedure, U parameters, string connectionStringName)
+ {
+ string connectionString = GetConnectionString(connectionStringName);
+
+ using (IDbConnection connection = new SqlConnection(connectionString))
+ {
+ List rows = connection.Query(storedProcedure, parameters,
+ commandType: CommandType.StoredProcedure).ToList();
+
+ return rows;
+ }
+ }
+
+ public void SaveData(string storedProcedure, T parameters, string connectionStringName)
+ {
+ string connectionString = GetConnectionString(connectionStringName);
+
+ using (IDbConnection connection = new SqlConnection(connectionString))
+ {
+ connection.Execute(storedProcedure, parameters,
+ commandType: CommandType.StoredProcedure);
+ }
+ }
+ }
+}
diff --git a/RMDataManagerLibrary/Models/UserModel.cs b/RMDataManagerLibrary/Models/UserModel.cs
new file mode 100644
index 0000000..2b5221b
--- /dev/null
+++ b/RMDataManagerLibrary/Models/UserModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RMDataManagerLibrary.Models
+{
+ public class UserModel
+ {
+ public string Id { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public string EmailAddress { get; set; }
+ public DateTime CreatedDate { get; set; }
+ }
+}
diff --git a/RMDataManagerLibrary/Properties/AssemblyInfo.cs b/RMDataManagerLibrary/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dc227de
--- /dev/null
+++ b/RMDataManagerLibrary/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("RMDataManagerLibrary")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("RMDataManagerLibrary")]
+[assembly: AssemblyCopyright("Copyright © 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6669f7dc-4b07-497f-bdee-5333db3edbf4")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/RMDataManagerLibrary/RMDataManagerLibrary.csproj b/RMDataManagerLibrary/RMDataManagerLibrary.csproj
new file mode 100644
index 0000000..897e7d5
--- /dev/null
+++ b/RMDataManagerLibrary/RMDataManagerLibrary.csproj
@@ -0,0 +1,58 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}
+ Library
+ Properties
+ RMDataManagerLibrary
+ RMDataManagerLibrary
+ v4.7.2
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\Dapper.2.0.123\lib\net461\Dapper.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RMDataManagerLibrary/packages.config b/RMDataManagerLibrary/packages.config
new file mode 100644
index 0000000..5c72a93
--- /dev/null
+++ b/RMDataManagerLibrary/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Retail_manager.sln b/Retail_manager.sln
index 6706818..569a991 100644
--- a/Retail_manager.sln
+++ b/Retail_manager.sln
@@ -9,6 +9,8 @@ Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "RMData", "RMData\RMData.sql
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMWPFUserInterface", "RMWPFUserInterface\RMWPFUserInterface.csproj", "{90936557-936E-4310-90C1-45254FEEA7B1}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMDataManagerLibrary", "RMDataManagerLibrary\RMDataManagerLibrary.csproj", "{6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -29,6 +31,10 @@ Global
{90936557-936E-4310-90C1-45254FEEA7B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90936557-936E-4310-90C1-45254FEEA7B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90936557-936E-4310-90C1-45254FEEA7B1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6669F7DC-4B07-497F-BDEE-5333DB3EDBF4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE