Clothes.DAL/CLDressDAL.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Clothes.Model;
using Clothes.IDAL;
namespace Clothes.DAL
{
public class CLDressDAL:BaseDAL<CLDress>,CLDressIDAL
{
/// <summary>
/// 根据Id进行降序排序
/// </summary>
/// <returns></returns>
public List<CLDress> SelctOrderBy()
{
return context.CLDress.OrderByDescending(a => a.Id).ToList();
}
public bool Edit(int id, int shu)
{
using (ClothesContext db = new ClothesContext())
{
var e = db.CLDress.FirstOrDefault(a => a.Id == id);
int a1 = Convert.ToInt32(e.Surplus);
int a3 =Convert.ToInt32(e.Number) +shu;
if (a1 > a3) {
int a2 = a1 - a3;
e.Number = a3;
e.Sur = a2;
return db.SaveChanges() > 0;
}
if (a1 < a3) {
return false;
}
return false;
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。