public async Task <CheckList> CreateAsync(CheckListCreateApiModel created, int userId) { var check = _CheckListContext.Create(created, userId); var stores = await _storeContext.GetListByDepartmentAsync(created.HospitalDepartmentId); foreach (var s in stores) { _CheckListGoodsContext.Create(new CheckListGoodsCreateApiModel { CheckListId = check.Id, CheckQty = s.Qty, StoreQty = s.Qty, HospitalGoodsId = s.HospitalGoods.Id, }, userId); } return(check); }