public async Task <ActionResult> ApplyLeaveInfo(LeaveInfoModel model) { var result = new JsonModel(); // 数据有误 if (!ModelState.IsValid) { result.GetError(ModelState); return(Json(result)); } #region //插入业务数据 LeaveInfo leaveInfo = null; if (model.Id != 0) { leaveInfo = await LeaveInfoRepository.GetByIdAsync(model.Id); } if (leaveInfo == null) { leaveInfo = new LeaveInfo(); } Mapper.Map(model, leaveInfo); leaveInfo.CommonStatus = CommonStatus.Disabled; await LeaveInfoRepository.SaveAsync(leaveInfo); #endregion #region 处理流程 await DealProcess(model, leaveInfo.Id, result, "Days_" + leaveInfo.Days); #endregion return(Json(result)); }
public async Task <AggregateRoot> GetSourceAsync(TableSource src, long srcId) { switch (src) { case TableSource.LeaveInfo: return((AggregateRoot)(await LeaveInfoRepository.GetByIdAsync(srcId))); case TableSource.SealInfo: return((AggregateRoot)(await SealInfoRepository.GetByIdAsync(srcId))); case TableSource.MeetingRoomInfo: var model = await MeetingRoomInfoRepository.GetByIdAsync(srcId); return((AggregateRoot)(model)); default: break; } return(null); }
public LeavesController(LeaveManagementDbContext leaveInfo) { _dbContext = leaveInfo; _leaveRepo = new LeaveInfoRepository(_dbContext); }