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 /// /// Initializes a new instance of the CustomerController class /// /// Global DbContext. /// Global user helper. 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 } }