public async Task <long> CreateOrUpdateChuKyAsync(ChuKyDto input) { if (input.Id > 0) { using (var unitOfWork = _unitOfWorkManager.Begin()) { // update long parentId = input.Id; input.Id = 0; var insertInput = input.MapTo <ChuKy>(); insertInput.IsActive = true; insertInput.PId = (input.PId ?? parentId); await _chuKyRepos.InsertAsync(insertInput); InActiveChuKyByIdAsync(parentId, input.IsDaXuLy); await CurrentUnitOfWork.SaveChangesAsync(); unitOfWork.Complete(); return(insertInput.Id); } } else { try { var insertInput = input.MapTo <ChuKy>(); await _chuKyRepos.InsertAsync(insertInput); await CurrentUnitOfWork.SaveChangesAsync(); return(insertInput.Id); } catch (Exception ex) { throw new Exception(ex.Message); } } }
public DoanhNghiepDto() { ThongTinPhapLy = new List <ThongTinPhapLy>(); chuKy = new ChuKyDto(); }