コード例 #1
0
        public ActionResult _PartialTemplateVariable()
        {
            #region 範本變數
            var variableAgent = db.EmailScheduleSetting.Where(s => s.Name == "AgentID").FirstOrDefault();
            TemplateVariables templatevariables = new TemplateVariables();
            templatevariables.AgentID = (variableAgent == null) ? "" : variableAgent.Value;
            #endregion

            return PartialView("~/Areas/EmailSrv/Views/EmailReplyTemplate/_PartialTemplateVariable.cshtml", templatevariables);
        }
コード例 #2
0
        public ActionResult _PartialTemplateVariable(TemplateVariables templatevariables)
        {
            var agentVar = db.EmailScheduleSetting.Where(s => s.Name == "AgentID").FirstOrDefault();
            if (agentVar == null)
            {
                var emailsetting = new EEmailScheduleSetting();
                emailsetting.Name = "AgentID";
                emailsetting.Value = templatevariables.AgentID;
                emailsetting.Period = 1;
                db.EmailScheduleSetting.Add(emailsetting);
            }
            else
            {
                agentVar.Value = templatevariables.AgentID;
                agentVar.Period = 1;

                db.Entry(agentVar).State = EntityState.Modified;
            }

            db.SaveChanges();
            return RedirectToAction("Index");
        }