Skip to content
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
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
16 changes: 16 additions & 0 deletions Backend/AppraisalSystemBackend/AppraisalSystemBackend.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>
</Project>
25 changes: 25 additions & 0 deletions Backend/AppraisalSystemBackend/AppraisalSystemBackend.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31321.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppraisalSystemBackend", "AppraisalSystemBackend.csproj", "{C3CCE910-0CDA-4EEA-BDFF-B0F1F18C381D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C3CCE910-0CDA-4EEA-BDFF-B0F1F18C381D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3CCE910-0CDA-4EEA-BDFF-B0F1F18C381D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3CCE910-0CDA-4EEA-BDFF-B0F1F18C381D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3CCE910-0CDA-4EEA-BDFF-B0F1F18C381D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {58A5E8D9-73A3-4E97-9643-C6DB30456939}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using AppraisalSystemBackend.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AppraisalSystemBackend.Controllers
{
public class AuthenticateController : Controller
{
DataAccessLayer da = new DataAccessLayer();

#region Route for login
[HttpPost]
[Route("api/Employee/Authenticate")]
public EmployeeBasic Authenticate([FromBody] AuthenticationDto LoginData)
{
return da.Login(LoginData);
}
#endregion
}
}
44 changes: 44 additions & 0 deletions Backend/AppraisalSystemBackend/Controllers/EmployeeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using AppraisalSystemBackend.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AppraisalSystemBackend.Controllers
{
#region All employee related routes are handled in this controller
public class EmployeeController : Controller
{
DataAccessLayer da = new DataAccessLayer();

#region Method for fetching assigned feedback for employee
[HttpGet]
[Route("api/Employee/ViewFeedback/{Id}")]
public List<AssignedFeedbacks> GetEmployee(int Id)
{
return da.ViewAssignedFeedback(Convert.ToInt32(Id));
}
#endregion

#region Method for fetching feedback based on emp id
[HttpGet]
[Route("api/Employee/GetFeedback/{Id}")]
public Feedback GetEmployeeFeedback(int Id)
{
return da.GetEmployeeFeedback(Convert.ToInt32(Id));
}
#endregion

#region Method for updating feedback
[HttpPut]
[Route("api/Employee/UpdateFeedback")]
public GenericReturn UpdateFeedback([FromBody] FeedbackDto feedback)
{
return da.UpdateEmployeeFeedback(feedback);
}
#endregion
}
#endregion
}
38 changes: 38 additions & 0 deletions Backend/AppraisalSystemBackend/Controllers/ErrorController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AppraisalSystemBackend.Controllers
{
public class ErrorController : ControllerBase
{
#region Routes for handling hiding stack information on localhost
[HttpGet]
[Route("/error-local-development")]
public IActionResult ErrorLocalDevelopment(
[FromServices] IWebHostEnvironment webHostEnvironment)
{
if (webHostEnvironment.EnvironmentName != "Development")
{
throw new InvalidOperationException(
"This shouldn't be invoked in non-development environments.");
}

var context = HttpContext.Features.Get<IExceptionHandlerFeature>();

return Problem(
title: context.Error.Message);
}

[HttpGet]
[Route("/error")]
public IActionResult Error() => Problem();

#endregion
}
}
104 changes: 104 additions & 0 deletions Backend/AppraisalSystemBackend/Controllers/WebMasterController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using AppraisalSystemBackend.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AppraisalSystemBackend.Controllers
{
#region All admin related routes are handled in this controller
public class WebMasterController : Controller
{
DataAccessLayer da = new DataAccessLayer();

#region Method to get all employee

[HttpGet]
[Route("api/WebMaster/GetEmployee")]
public IEnumerable<EmployeeBasic> GetEmployee()
{
return da.GetAllEmployees();
}
#endregion

#region Method to add new employee
[HttpPost]
[Route("api/WebMaster/CreateEmployee")]
public GenericReturn Create([FromBody] Employee employee)
{
return da.AddEmployee(employee);
}
#endregion

#region Method get employee details from id
[HttpGet]
[Route("api/WebMaster/GetEmployeeDetails/{id}")]
public Employee Details(int id)
{
return da.GetEmployeeData(id);
}
#endregion

#region Method to update employee
[HttpPut]
[Route("api/WebMaster/UpdateEmployeeDetails")]
public GenericReturn Edit([FromBody] EmployeeBasic employee)
{
return da.UpdateEmployee(employee);
}
#endregion

#region Method to delete employee
[HttpDelete]
[Route("api/WebMaster/DeleteEmployee/{id}")]
public GenericReturn Delete(int id)
{
return da.DeleteEmployee(id);
}
#endregion

#region Method to fetch additional information of employee
[HttpGet]
[Route("api/WebMaster/EmployeeAdditionalInfo/{id}")]
public EmployeeAdditionalData EmployeeAdditionalInfo(string id)
{
return da.EmployeeData(Convert.ToInt32(id));
}
#endregion


#region Method to update employee feedback
[HttpPut]
[Route("api/WebMaster/UpdateEmployeeFeedback")]
public GenericReturn EditFeedback([FromBody] FeedbackDto feedback)
{
return da.UpdateEmployeeFeedback(feedback);
}
#endregion


#region Method to delete employee feedback
[HttpDelete]
[Route("api/WebMaster/DeleteEmployeeFeedback/{id}")]
public GenericReturn DeleteEmployeeFeedback(int id)
{
return da.DeleteEmployeeFeedback(id);
}
#endregion

#region Method to assign feedback to employee
[HttpPost]
[Route("api/WebMaster/AssignFeedback/")]
public GenericReturn AssignFeedback([FromBody] AssignFeedbackDto feedbackData)
{
return da.AssignFeedback(feedbackData);
}
#endregion



}
#endregion
}
79 changes: 79 additions & 0 deletions Backend/AppraisalSystemBackend/Models/CompanyContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable disable

namespace AppraisalSystemBackend.Models
{
public partial class CompanyContext : DbContext
{
public CompanyContext()
{
}

public CompanyContext(DbContextOptions<CompanyContext> options)
: base(options)
{
}

public virtual DbSet<Employee> Employees { get; set; }
public virtual DbSet<Feedback> Feedbacks { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
optionsBuilder.UseSqlServer("Data Source=DESKTOP-T7843PQ\\SQLEXPRESS;Initial Catalog=Company;User ID=testuser;Password=password");
}
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");

modelBuilder.Entity<Employee>(entity =>
{
entity.ToTable("Employee");

entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("ID");

entity.Property(e => e.Email)
.IsRequired()
.HasColumnType("text");

entity.Property(e => e.Name)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);

entity.Property(e => e.Password).HasColumnType("text");
});

modelBuilder.Entity<Feedback>(entity =>
{
entity.ToTable("Feedback");

entity.Property(e => e.Id).HasColumnName("ID");

entity.Property(e => e.AssignedId).HasColumnName("AssignedID");

entity.Property(e => e.Description).HasColumnType("text");

entity.Property(e => e.EmpId).HasColumnName("EmpID");

entity.HasOne(d => d.Emp)
.WithMany(p => p.Feedbacks)
.HasForeignKey(d => d.EmpId)
.HasConstraintName("FK__Feedback__EmpID__276EDEB3");
});

OnModelCreatingPartial(modelBuilder);
}

partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}
Loading