Himall.Service/TopicService.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Himall.Core;
using Himall.Core.Helper;
using Himall.Entity;
using Himall.IServices;
using Himall.IServices.QueryModel;
using Himall.Model;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Transactions;
namespace Himall.Service
{
public class TopicService : ServiceBase, ITopicService, IService, IDisposable
{
public TopicService()
{
}
public void AddTopic(TopicInfo topicInfo)
{
if (string.IsNullOrWhiteSpace(topicInfo.Name))
{
throw new ArgumentNullException("专题名称不能为空");
}
string empty = string.Empty;
TransactionScope transactionScope = new TransactionScope();
try
{
try
{
context.TopicInfo.Add(topicInfo);
context.SaveChanges();
string topImage = topicInfo.TopImage;
string backgroundImage = topicInfo.BackgroundImage;
string frontCoverImage = topicInfo.FrontCoverImage;
empty = MoveImages(topicInfo.Id, ref backgroundImage, ref topImage, ref frontCoverImage);
topicInfo.TopImage = topImage;
topicInfo.BackgroundImage = backgroundImage;
topicInfo.FrontCoverImage = frontCoverImage;
context.SaveChanges();
transactionScope.Complete();
}
catch (Exception exception1)
{
Exception exception = exception1;
if (!string.IsNullOrWhiteSpace(empty))
{
try
{
Directory.Delete(empty);
}
catch
{
}
}
后面还有 188 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
