| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using GreenTree.Strohrmann.ERP.Core.Domain.Business;
- using GreenTree.Strohrmann.ERP.Core.Helper;
- using GreenTree.Strohrmann.ERP.Domain.Model;
- using GreenTree.Strohrmann.ERP.Web.Models.Business;
- using GreenTree.Strohrmann.ERP.Web.Models.Rights.User;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- namespace GreenTree.Strohrmann.ERP.Web.Controllers
- {
- public class CustomerController : Controller
- {
- #region DI fields
- // The global DbContext
- private readonly ERPDbContext _eRPDbContext;
- // The global user helper
- private readonly IUserHelper _userHelper;
- #endregion
- #region Ctor
- /// <summary>
- /// Initializes a new instance of the CustomerController class
- /// </summary>
- /// <param name="eRPDbContext">Global DbContext.</param>
- /// <param name="userHelper">Global user helper.</param>
- public CustomerController(
- ERPDbContext eRPDbContext,
- IUserHelper userHelper)
- {
- _eRPDbContext = eRPDbContext;
- _userHelper = userHelper;
- }
- #endregion
- #region Actions
- // GET: CustomerController
- public ActionResult Index()
- {
- var customers = _eRPDbContext.Customers
- .ToList()
- .Select(c => new CustomerModel(c));
- return View(customers);
- }
- // GET: CustomerController/Details/5
- public ActionResult Details(int id)
- {
- return View();
- }
- // GET: CustomerController/Create
- public ActionResult Create()
- {
- return View();
- }
- // POST: CustomerController/Create
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Create(IFormCollection collection)
- {
- try
- {
- return RedirectToAction(nameof(Index));
- }
- catch
- {
- return View();
- }
- }
- // GET: CustomerController/Edit/5
- public ActionResult Edit(int id)
- {
- return View();
- }
- // POST: CustomerController/Edit/5
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Edit(int id, IFormCollection collection)
- {
- try
- {
- return RedirectToAction(nameof(Index));
- }
- catch
- {
- return View();
- }
- }
- // GET: CustomerController/Delete/5
- public ActionResult Delete(int id)
- {
- return View();
- }
- // POST: CustomerController/Delete/5
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Delete(int id, IFormCollection collection)
- {
- try
- {
- return RedirectToAction(nameof(Index));
- }
- catch
- {
- return View();
- }
- }
- #endregion
- }
- }
|