public static void Create(MailLog model) { model.Id = (int)Current.DB.MailLogs.Insert( new { model.UserId, model.MailType, model.ToAddr, model.CcAddr, model.Subject, model.Message, model.Attachment, CreateTime = DateTime.Now, Status = MailStatus.Sending, ErrorMsg = "" }); }
public static void Update(MailLog model) { string sql = ""; if (model.Status == MailStatus.Success) { sql = @" update MailLogs set SentTime=@SentTime, Status=@Status where Id = @id"; } else { sql = @" update MailLogs set Status=@Status, ErrorMsg=@ErrorMsg where Id = @id"; } Current.DB.Execute(sql, model); }