Himall.Service/GiftService.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.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Himall.Service
{
public class GiftService : ServiceBase, IGiftService, IService, IDisposable
{
public GiftService()
{
}
public void AddGift(GiftInfo model)
{
context.GiftInfo.Add(model);
context.SaveChanges();
if (string.IsNullOrWhiteSpace(model.ImagePath))
{
model.ImagePath = string.Format("/Storage/Gift/{0}", model.Id);
}
context.SaveChanges();
model.Description = HTMLProcess(model.Description, model.ImagePath);
context.SaveChanges();
}
public void ChangeStatus(long id, bool status)
{
GiftInfo giftInfo = context.GiftInfo.FindById<GiftInfo>(id);
if (giftInfo == null)
{
throw new HimallException(string.Concat("未找到id为", id, "的礼品"));
}
if (!status)
{
giftInfo.SalesStatus = GiftInfo.GiftSalesStatus.OffShelves;
}
else
{
giftInfo.SalesStatus = GiftInfo.GiftSalesStatus.Normal;
if (giftInfo.EndDate.Date < DateTime.Now.Date)
{
giftInfo.EndDate = DateTime.Now.AddMonths(1);
}
}
context.SaveChanges();
}
public GiftInfo GetById(long id)
{
后面还有 226 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
