65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BankSampahApp.Controllers.Registrasi
|
|
{
|
|
[Route("[controller]/[action]")]
|
|
public class RegistrasiController : Controller
|
|
{
|
|
private readonly ILogger<RegistrasiController> _logger;
|
|
|
|
public RegistrasiController(ILogger<RegistrasiController> logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Halaman register nasabah
|
|
/// </summary>
|
|
[HttpGet]
|
|
public IActionResult RegisterNasabah()
|
|
{
|
|
return View("~/Views/Registrasi/RegisterNasabah.cshtml");
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult RegisterBankSampah()
|
|
{
|
|
return View("~/Views/Registrasi/RegisterBankSampah.cshtml");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handle form submission register nasabah
|
|
/// </summary>
|
|
[HttpPost]
|
|
public IActionResult RegisterNasabah(RegisterNasabahViewModel model)
|
|
{
|
|
if (!ModelState.IsValid)
|
|
{
|
|
return View("~/Views/Registrasi/RegisterNasabah.cshtml", model);
|
|
}
|
|
|
|
// TODO: Implement registration logic
|
|
// For now, just log and redirect
|
|
_logger.LogInformation("New customer registration attempt: {Username}", model.Username);
|
|
|
|
TempData["SuccessMessage"] = "Pendaftaran berhasil! Silakan login.";
|
|
return RedirectToAction("Login", "Account");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// ViewModel untuk form register nasabah
|
|
/// </summary>
|
|
public class RegisterNasabahViewModel
|
|
{
|
|
public string NamaLengkap { get; set; } = string.Empty;
|
|
public string AlamatEmail { get; set; } = string.Empty;
|
|
public string JenisNasabah { get; set; } = string.Empty;
|
|
public string Username { get; set; } = string.Empty;
|
|
public string Password { get; set; } = string.Empty;
|
|
public string ConfirmPassword { get; set; } = string.Empty;
|
|
}
|
|
}
|