2025-05-28 13:34:48 -07:00

127 lines
2.4 KiB
C#

#if !NET8
using System.Web;
using System.Web.Mvc;
#endif
#if NET8
using Microsoft.AspNetCore.Mvc;
#endif
#if !NET8
using System;
using System.Collections.Generic;
using System.Linq;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
#endif
#if !NET8
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
#endif
namespace Fab2ApprovalSystem.Controllers;
#if NET8
[Route("[controller]")]
#endif
public class WorkflowController : Controller {
// GET: /Workflow/Details/5
public ActionResult Details(int id) {
return View();
}
// GET: /Workflow/Create
public ActionResult Create() {
return View();
}
#if !NET8
// POST: /Workflow/Create
[HttpPost]
public ActionResult Create(FormCollection collection) {
try {
// TODO: Add insert logic here
return RedirectToAction("Index");
} catch {
return View();
}
}
#endif
// GET: /Workflow/Edit/5
public ActionResult Edit(int id) {
return View();
}
#if !NET8
// POST: /Workflow/Edit/5
[HttpPost]
public ActionResult Edit(int id, FormCollection collection) {
try {
// TODO: Add update logic here
return RedirectToAction("Index");
} catch {
return View();
}
}
#endif
// GET: /Workflow/Delete/5
public ActionResult Delete(int id) {
return View();
}
#if !NET8
// POST: /Workflow/Delete/5
[HttpPost]
public ActionResult Delete(int id, FormCollection collection) {
try {
// TODO: Add delete logic here
return RedirectToAction("Index");
} catch {
return View();
}
}
#endif
#if !NET8
private System.Web.HttpSessionStateBase GetSession() =>
Session;
private JsonResult GetJsonResult(object? data) =>
Json(data, JsonRequestBehavior.AllowGet);
private bool IsAjaxRequest() =>
Request.IsAjaxRequest();
#endif
#if NET8
private Microsoft.AspNetCore.Http.ISession GetSession() =>
HttpContext.Session;
private JsonResult GetJsonResult(object? data) =>
Json(data);
private bool IsAjaxRequest() =>
Request.Headers.TryGetValue("X-Requested-With", out Microsoft.Extensions.Primitives.StringValues strings) && strings[0] == "XMLHttpRequest";
#endif
private string GetUserIdentityName() =>
@User.Identity.Name;
}