using NFine.Application.Encrypt;
using NFine.Code;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace NFine.Web.Areas.Encrypt.Controllers
{
    public class EnciphermentController : Controller
    {

        EnciphermentApp App = new EnciphermentApp();
        // GET: Encrypt/ncrypt
        public ActionResult Encrypt()
        {
           
            return View();
        }

        [HttpPost]
        [HandlerAjaxOnly]
        public ActionResult Encryption(string ICSInspections)
        {
        
            try
            {
                App.Encryption(ICSInspections);
                return Success("加密成功");
            }
            catch (Exception ex)
            {
                return Error(ex.Message);
            }

        }
        protected virtual ActionResult Success(string message)
        {
            return Content(new AjaxResult { state = ResultType.success.ToString(), message = message }.ToJson());
        }
        protected virtual ActionResult Success(string message, object data)
        {
            return Content(new AjaxResult { state = ResultType.success.ToString(), message = message, data = data }.ToJson());
        }
        protected virtual ActionResult Error(string message)
        {
            return Content(new AjaxResult { state = ResultType.error.ToString(), message = message }.ToJson());
        }
    }
}