-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94c6c78
commit 2ff77c3
Showing
78 changed files
with
41,687 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Diagnostics; | ||
using Team4_Project.Models; | ||
|
||
namespace Team4_Project.Controllers | ||
{ | ||
public class CustomerController : Controller | ||
{ | ||
private ATMContext context { get; set; } | ||
public CustomerController(ATMContext ctx) | ||
{ | ||
context = ctx; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Add() | ||
{ | ||
ViewBag.Action = "Add"; | ||
return View("Edit", new Customer()); | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Edit(int id) | ||
{ | ||
ViewBag.Action = "Edit"; | ||
var customer = context.Customer.Find(id); | ||
return View(customer); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Edit(Customer customer) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
if (customer.CustomerID == 0) | ||
{ | ||
context.Customer.Add(customer); | ||
} | ||
else | ||
{ | ||
context.Customer.Update(customer); | ||
} | ||
context.SaveChanges(); | ||
return RedirectToAction("CustomerList", "Customer"); | ||
} | ||
else | ||
{ | ||
ViewBag.Action = (customer.CustomerID == 0) ? "Add" : "Edit"; | ||
return View(customer); | ||
} | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Delete(int id) | ||
{ | ||
var customer = context.Customer.Find(id); | ||
return View(customer); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Delete(Customer customer) | ||
{ | ||
context.Customer.Remove(customer); | ||
context.SaveChanges(); | ||
return RedirectToAction("CustomerList", "Customer"); | ||
} | ||
public IActionResult CustomerList() | ||
{ | ||
var customers = context.Customer.OrderBy(m => m.CustomerID).ToList(); | ||
return View(customers); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Diagnostics; | ||
using Team4_Project.Models; | ||
|
||
namespace Team4_Project.Controllers | ||
{ | ||
public class EmployeeController : Controller | ||
{ | ||
private ATMContext context { get; set; } | ||
public EmployeeController(ATMContext ctx) | ||
{ | ||
context = ctx; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Add() | ||
{ | ||
ViewBag.Action = "Add"; | ||
return View("Edit", new Employee()); | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Edit(int id) | ||
{ | ||
ViewBag.Action = "Edit"; | ||
var customer = context.Employee.Find(id); | ||
return View(customer); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Edit(Employee employee) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
if (employee.EmployeeID == 0) | ||
{ | ||
context.Employee.Add(employee); | ||
} | ||
else | ||
{ | ||
context.Employee.Update(employee); | ||
} | ||
context.SaveChanges(); | ||
return RedirectToAction("EmployeeList", "Employee"); | ||
} | ||
else | ||
{ | ||
ViewBag.Action = (employee.EmployeeID == 0) ? "Add" : "Edit"; | ||
return View(employee); | ||
} | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Delete(int id) | ||
{ | ||
var employee = context.Employee.Find(id); | ||
return View(employee); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Delete(Employee employee) | ||
{ | ||
context.Employee.Remove(employee); | ||
context.SaveChanges(); | ||
return RedirectToAction("EmployeeList", "Employee"); | ||
} | ||
public IActionResult EmployeeList() | ||
{ | ||
var employees = context.Employee.OrderBy(m => m.EmployeeID).ToList(); | ||
return View(employees); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Team4_Project.Models; | ||
|
||
namespace Team4_Project.Controllers | ||
{ | ||
public class HomeController : Controller | ||
{ | ||
private readonly ILogger<HomeController> _logger; | ||
|
||
public HomeController(ILogger<HomeController> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
public IActionResult Privacy() | ||
{ | ||
return View(); | ||
} | ||
|
||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | ||
public IActionResult Error() | ||
{ | ||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Team4_Project.Models; | ||
|
||
namespace Team4_Project.Controllers | ||
{ | ||
public class InventoryController : Controller | ||
{ | ||
private ATMContext context { get; set; } | ||
public InventoryController(ATMContext ctx) | ||
{ | ||
context = ctx; | ||
} | ||
|
||
public IActionResult Inventory() | ||
{ | ||
var inventory = context.Inventory.OrderBy(m => m.ItemID).ToList(); | ||
return View(inventory); | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Add() | ||
{ | ||
ViewBag.Action = "Add"; | ||
return View("Edit", new Inventory()); | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Edit(int id) | ||
{ | ||
ViewBag.Action = "Edit"; | ||
var item = context.Inventory.Find(id); | ||
return View(item); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Edit(Inventory item) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
if (item.ItemID == 0) | ||
{ | ||
context.Inventory.Add(item); | ||
} | ||
else | ||
{ | ||
context.Inventory.Update(item); | ||
} | ||
context.SaveChanges(); | ||
return RedirectToAction("Inventory", "Inventory"); | ||
} | ||
else | ||
{ | ||
ViewBag.Action = (item.ItemID == 0) ? "Add" : "Edit"; | ||
return View(item); | ||
} | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Delete(int id) | ||
{ | ||
var item = context.Inventory.Find(id); | ||
return View(item); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Delete(Inventory item) | ||
{ | ||
context.Inventory.Remove(item); | ||
context.SaveChanges(); | ||
return RedirectToAction("Inventory", "Inventory"); | ||
} | ||
} | ||
} |
Oops, something went wrong.