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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file added .vs/Int_Coms_App/v17/.wsuo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
10 changes: 10 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ExpandedNodes": [
"",
"\\ABD_CRM",
"\\ABD_CRM\\ABD_CRM",
"\\ABD_CRM\\ABD_CRM\\Models"
],
"SelectedNode": "\\ABD_CRM\\ABD_CRM\\Models\\ErrorViewModel.cs",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file added ABD_CRM/.vs/ABD_CRM/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
985 changes: 985 additions & 0 deletions ABD_CRM/.vs/ABD_CRM/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added ABD_CRM/.vs/ABD_CRM/v17/.futdcache.v2
Binary file not shown.
Binary file added ABD_CRM/.vs/ABD_CRM/v17/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 18 additions & 2 deletions ABD_CRM/ABD_CRM/ABD_CRM.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>7277abca-aec4-4d26-9a5f-dd5bf4106bec</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.16" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions ABD_CRM/ABD_CRM/ABD_CRM.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<View_SelectedScaffolderID>RazorViewEmptyScaffolder</View_SelectedScaffolderID>
<View_SelectedScaffolderCategoryPath>root/Common/MVC/View</View_SelectedScaffolderCategoryPath>
<Controller_SelectedScaffolderID>MvcControllerWithContextScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>650</WebStackScaffolding_ControllerDialogWidth>
<_SelectedScaffolderID>AreaScaffolder</_SelectedScaffolderID>
<_SelectedScaffolderCategoryPath>root/Common</_SelectedScaffolderCategoryPath>
<WebStackScaffolding_DependencyDialogWidth>650</WebStackScaffolding_DependencyDialogWidth>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_DbContextTypeFullName>ABD_CRM.Models.ABDContext</WebStackScaffolding_DbContextTypeFullName>
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<WebStackScaffolding_IsViewGenerationSelected>True</WebStackScaffolding_IsViewGenerationSelected>
</PropertyGroup>
</Project>
160 changes: 160 additions & 0 deletions ABD_CRM/ABD_CRM/Controllers/TblCompaniesController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using ABD_CRM.Models;

namespace ABD_CRM.Controllers
{
public class TblCompaniesController : Controller
{
private readonly ABDContext _context;

public TblCompaniesController(ABDContext context)
{
_context = context;
}

// GET: TblCompanies
public async Task<IActionResult> Index()
{
return View(await _context.TblCompanies.ToListAsync());
}

// GET: TblCompanies/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null || _context.TblCompanies == null)
{
return NotFound();
}

var tblCompany = await _context.TblCompanies
.FirstOrDefaultAsync(m => m.CompanyId == id);
if (tblCompany == null)
{
return NotFound();
}

return View(tblCompany);
}

// GET: TblCompanies/Create
public IActionResult Create()
{
return View();
}

// POST: TblCompanies/Create
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("CreatedById,CreateDate,LastUpdated,CompanyId,CompanyName,CompanyAddress,PhoneNum,DpName")] TblCompany tblCompany)
{
if (ModelState.IsValid)
{
_context.Add(tblCompany);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(tblCompany);
}

// GET: TblCompanies/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null || _context.TblCompanies == null)
{
return NotFound();
}

var tblCompany = await _context.TblCompanies.FindAsync(id);
if (tblCompany == null)
{
return NotFound();
}
return View(tblCompany);
}

// POST: TblCompanies/Edit/5
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("CreatedById,CreateDate,LastUpdated,CompanyId,CompanyName,CompanyAddress,PhoneNum,DpName")] TblCompany tblCompany)
{
if (id != tblCompany.CompanyId)
{
return NotFound();
}

if (ModelState.IsValid)
{
try
{
_context.Update(tblCompany);
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!TblCompanyExists(tblCompany.CompanyId))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(tblCompany);
}

// GET: TblCompanies/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null || _context.TblCompanies == null)
{
return NotFound();
}

var tblCompany = await _context.TblCompanies
.FirstOrDefaultAsync(m => m.CompanyId == id);
if (tblCompany == null)
{
return NotFound();
}

return View(tblCompany);
}

// POST: TblCompanies/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
if (_context.TblCompanies == null)
{
return Problem("Entity set 'ABDContext.TblCompanies' is null.");
}
var tblCompany = await _context.TblCompanies.FindAsync(id);
if (tblCompany != null)
{
_context.TblCompanies.Remove(tblCompany);
}

await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}

private bool TblCompanyExists(int id)
{
return _context.TblCompanies.Any(e => e.CompanyId == id);
}
}
}
167 changes: 167 additions & 0 deletions ABD_CRM/ABD_CRM/Controllers/TblContactsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using ABD_CRM.Models;

namespace ABD_CRM.Controllers
{
public class TblContactsController : Controller
{
private readonly ABDContext _context;

public TblContactsController(ABDContext context)
{
_context = context;
}

// GET: TblContacts
public async Task<IActionResult> Index()
{
var aBDContext = _context.TblContacts.Include(t => t.Company);
return View(await aBDContext.ToListAsync());
}

// GET: TblContacts/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null || _context.TblContacts == null)
{
return NotFound();
}

var tblContact = await _context.TblContacts
.Include(t => t.Company)
.FirstOrDefaultAsync(m => m.ContactId == id);
if (tblContact == null)
{
return NotFound();
}

return View(tblContact);
}

// GET: TblContacts/Create
public IActionResult Create()
{
ViewData["CompanyId"] = new SelectList(_context.TblCompanies, "CompanyId", "CompanyId");
return View();
}

// POST: TblContacts/Create
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("CreatedBy,CreateDate,LastUpdated,ContactId,ContactName,Position,CompanyId")] TblContact tblContact)
{
if (ModelState.IsValid)
{
_context.Add(tblContact);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["CompanyId"] = new SelectList(_context.TblCompanies, "CompanyId", "CompanyId", tblContact.CompanyId);
return View(tblContact);
}

// GET: TblContacts/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null || _context.TblContacts == null)
{
return NotFound();
}

var tblContact = await _context.TblContacts.FindAsync(id);
if (tblContact == null)
{
return NotFound();
}
ViewData["CompanyId"] = new SelectList(_context.TblCompanies, "CompanyId", "CompanyId", tblContact.CompanyId);
return View(tblContact);
}

// POST: TblContacts/Edit/5
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("CreatedBy,CreateDate,LastUpdated,ContactId,ContactName,Position,CompanyId")] TblContact tblContact)
{
if (id != tblContact.ContactId)
{
return NotFound();
}

if (ModelState.IsValid)
{
try
{
_context.Update(tblContact);
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!TblContactExists(tblContact.ContactId))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
ViewData["CompanyId"] = new SelectList(_context.TblCompanies, "CompanyId", "CompanyId", tblContact.CompanyId);
return View(tblContact);
}

// GET: TblContacts/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null || _context.TblContacts == null)
{
return NotFound();
}

var tblContact = await _context.TblContacts
.Include(t => t.Company)
.FirstOrDefaultAsync(m => m.ContactId == id);
if (tblContact == null)
{
return NotFound();
}

return View(tblContact);
}

// POST: TblContacts/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
if (_context.TblContacts == null)
{
return Problem("Entity set 'ABDContext.TblContacts' is null.");
}
var tblContact = await _context.TblContacts.FindAsync(id);
if (tblContact != null)
{
_context.TblContacts.Remove(tblContact);
}

await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}

private bool TblContactExists(int id)
{
return _context.TblContacts.Any(e => e.ContactId == id);
}
}
}
Loading