|
@@ -39,38 +39,25 @@ namespace OASystem.Infrastructure.Repositories.Resource
|
|
|
{
|
|
|
if (dto.Status == 1)//添加
|
|
|
{
|
|
|
- Air_TicketBlackCode _TicketBlackCode = await _sqlSugar.Queryable<Air_TicketBlackCode>().FirstAsync(a=>a.IsDel==0 && a.BlackCode==dto.BlackCode && a.DiId==dto.DiId);//查询是否存在
|
|
|
- if (_TicketBlackCode != null)
|
|
|
- {
|
|
|
- return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
|
|
|
-
|
|
|
- }
|
|
|
- else//不存在,可添加
|
|
|
- {
|
|
|
-
|
|
|
- Air_TicketBlackCode air_TicketBlack = _mapper.Map<Air_TicketBlackCode>(dto);
|
|
|
- int id = await _sqlSugar.Insertable(air_TicketBlack).ExecuteReturnIdentityAsync();
|
|
|
- if (id == 0)
|
|
|
- {
|
|
|
- return result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
-
|
|
|
- }
|
|
|
- return result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
|
|
|
- }
|
|
|
+ Air_TicketBlackCode air_TicketBlack = _mapper.Map<Air_TicketBlackCode>(dto);
|
|
|
+ int id = await _sqlSugar.Insertable(air_TicketBlack).ExecuteReturnIdentityAsync();
|
|
|
+ return result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
|
|
|
}
|
|
|
else if (dto.Status == 2)//修改
|
|
|
{
|
|
|
bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Air_TicketBlackCode
|
|
|
{
|
|
|
- DiId=dto.DiId,
|
|
|
- BlackCode=dto.BlackCode,
|
|
|
- Price=dto.Price,
|
|
|
- NowPrice=dto.NowPrice,
|
|
|
- BCPrice=dto.BCPrice,
|
|
|
- ECPrice=dto.ECPrice,
|
|
|
+ DiId = dto.DiId,
|
|
|
+ BlackCode = dto.BlackCode,
|
|
|
+ Price = dto.Price,
|
|
|
+ NowPrice = dto.NowPrice,
|
|
|
+ BCPrice = dto.BCPrice,
|
|
|
+ ECPrice = dto.ECPrice,
|
|
|
CreateUserId = dto.CreateUserId,
|
|
|
Remark = dto.Remark,
|
|
|
Title = dto.Title,
|
|
|
+ FCPrice = dto.FCPrice,
|
|
|
+ FCNowPrice = dto.FCNowPrice
|
|
|
});
|
|
|
if (!res)
|
|
|
{
|
|
@@ -85,7 +72,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- return result = new Result() { Code = -2, Msg = "程序错误!" };
|
|
|
+ return result = new Result() { Code = -2, Msg = $"程序错误!({ex.Message})" };
|
|
|
}
|
|
|
}
|
|
|
|