public IActionResult AddApprovalProcess(string name, string ids) { if (IsNullOrEmpty(name) || IsNullOrEmpty(ids)) { return(Error()); } var userIds = ids.Split(","); var l = 1; List <ApprovalProcessDetail> list = new List <ApprovalProcessDetail>(); foreach (var it in userIds) { var uId = Convert.ToInt32(it); ApprovalProcessDetail approvalProcessDetail = new ApprovalProcessDetail { UserId = uId, Sort = l, CreatedBy = WorkContext.CurrentUser.Id, ModifiedBy = WorkContext.CurrentUser.Id, ModifiedTime = DateTime.Now, User = _userService.GetById(uId) }; list.Add(approvalProcessDetail); l++; } ApprovalProcess approvalProcess = new ApprovalProcess { Name = name, CreatedBy = WorkContext.CurrentUser.Id, ModifiedBy = WorkContext.CurrentUser.Id, ModifiedTime = DateTime.Now, ApprovalProcessDetail = list }; _orderService.InsertApprovalProcess(approvalProcess); var data = approvalProcess.ToModel(); return(Success(data)); }
public static ApprovalProcessDetailModel ToModel(this ApprovalProcessDetail entity) { return(Mapper.Map <ApprovalProcessDetail, ApprovalProcessDetailModel>(entity)); }