public string AddComment(string id, string comment) { CommentViewModel model = new CommentViewModel(); model.Comment = comment; model.CommentTime = DateTime.Now; model.ArticleId = id; string ip = IPHelper.GetIp(); model.IPAdress = ip; model.Name = IPHelper.GetAddressByIp(ip); //发送邮件提醒 MailDto dto = new MailDto(); dto.Subject = string.Format("您的文章有新的评论,请注意查收!"); dto.Body = string.Format(@"<a href='http://localhost:5823/Home/Article/{0}'>原文链接</a> {1}:{2}", id, model.Name, comment); MailHelper.Send(dto); return(articleService.InsertComment(model).ToString()); }