public JsonResult Add(SendMailLogVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = SendMailLogs.AddSendMailLog(SendMailLogs.SendMailLogVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="sendmaillog"></param> /// <returns></returns> public static SendMailLogInfo SendMailLogVModelToInfo(SendMailLogVModel sendmaillog) { if (sendmaillog == null) { return(new SendMailLogInfo()); } return(new SendMailLogInfo { Id = sendmaillog.Id, UserId = sendmaillog.UserId, SendUserId = sendmaillog.SendUserId, TemplateId = sendmaillog.TemplateId, ToEmail = sendmaillog.ToEmail, FromEmail = sendmaillog.FromEmail, Status = sendmaillog.Status, Title = sendmaillog.Title, Body = sendmaillog.Body, Ip = sendmaillog.Ip, IsSystem = sendmaillog.IsSystem, CreateTime = sendmaillog.CreateTime }); }
public ActionResult Add() { var vm = new SendMailLogVModel(); return(View(vm)); }
/// <summary> /// 写入邮件发送日志 /// </summary> /// <param name="model"></param> /// <returns></returns> public long Add(SendMailLogVModel model) { return(SendMailLogs.AddSendMailLog(SendMailLogs.SendMailLogVModelToInfo(model))); }