public async Task <bool> addSlice(SliceAssetDetailDto asset) { SliceAsset assetModel = new SliceAsset(); assetModel.AssetId = asset.AssetId; assetModel.Quantity = asset.Quantity; assetModel.Description = asset.Description; assetModel.TimeAsset = asset.TimeAsset; assetModel.MultiplierInTime = asset.MultiplierInTime; assetModel.AccountId = asset.AccountId; assetModel.ProjectId = asset.ProjectId; assetModel.TypeAssetId = asset.TypeAssetId; assetModel.TermId = asset.TermId; assetModel.AssetStatus = Status.ACTIVE; assetModel.AssetSlice = asset.AssetSlice; assetModel.CompanyId = asset.CompanyId; assetModel.CashPerSlice = asset.CashPerSlice; assetModel.SalaryGapInTime = asset.SalaryGapInTime; _context.SliceAssets.Add(assetModel); try { await _context.SaveChangesAsync(); return(true); } catch (DbUpdateException e) { Debug.WriteLine(e.InnerException.Message); throw; } }
public async Task <string> UpdateCompany(string id, CompanyDetailDto company) { Company dto = await _context.Companies.FindAsync(id); dto.CompanyName = company.CompanyName; dto.ComapnyIcon = company.ComapnyIcon; dto.NonCashMultiplier = company.NonCashMultiplier; dto.CashMultiplier = company.CashMultiplier; dto.CashPerSlice = company.CashPerSlice; _context.Entry(dto).State = EntityState.Modified; await _context.SaveChangesAsync(); return(dto.CompanyId); }
public async Task AddProject(ProjectDto project) { Project projectModel = new Project(); projectModel.ProjectId = project.ProjectId; projectModel.ProjectName = project.ProjectName; projectModel.ProjectStatus = Status.ACTIVE; projectModel.CompanyId = project.CompanyId; _context.Projects.Add(projectModel); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { throw; } }
public async Task CreateAssetCompany(int typeAssetID, string companyID) { TypeAssetCompany type = new TypeAssetCompany(); type.CompanyId = companyID; type.TypeAssetId = typeAssetID; _context.TypeAssetCompanies.Add(type); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { throw; } }