public async Task ChangeStatusAsync(int id, int to, string message = "") { var montageSupplyRequest = await GetByIdAsync(id); montageSupplyRequest.StatusSupply = (SupplyStatusEnum)to; if ((SupplyStatusEnum)to == SupplyStatusEnum.Ready) { await _montageService.IncreaseQuantityAsync(montageSupplyRequest.ComponentId, montageSupplyRequest.Quantity); } await _currentRepository.UpdateAsync(montageSupplyRequest); await _db.SaveAsync(); await _db.LogRepository.CreateAsync(new Log { Message = message, MontageSupplyRequestId = montageSupplyRequest.Id, DesignId = montageSupplyRequest.ComponentId, TaskId = montageSupplyRequest.TaskId }); await _db.SaveAsync(); }
public async System.Threading.Tasks.Task ReceiveComponentAsync(int taskId, int obtainedCompId, int componentObt) { var obtMont = await _db.ObtainedMontageRepository.GetByIdAsync(obtainedCompId); if (obtMont != null) { obtMont.Obtained += componentObt; await _montageService.IncreaseQuantityAsync(obtMont.ComponentId, -componentObt); await _db.ObtainedMontageRepository.UpdateAsync(obtMont); } await _db.SaveAsync(); }