public async Task ChangeStatusAsync(int id, int to, string message = "") { var designSupplyRequest = await GetByIdAsync(id); designSupplyRequest.StatusSupply = (SupplyStatusEnum)to; if ((SupplyStatusEnum)to == SupplyStatusEnum.Ready) { await _designService.IncreaseQuantityAsync(designSupplyRequest.ComponentId, designSupplyRequest.Quantity); } await _currentRepository.UpdateAsync(designSupplyRequest); await _db.SaveAsync(); await _db.LogRepository.CreateAsync(new Log { Message = message, DesignSupplyRequestId = designSupplyRequest.Id, DesignId = designSupplyRequest.ComponentId, TaskId = designSupplyRequest.TaskId }); await _db.SaveAsync(); }
public async System.Threading.Tasks.Task ReceiveDesignAsync(int taskId, int obtainedDesId, int designObt) { var obtDes = await _db.ObtainedDesignRepository.GetByIdAsync(obtainedDesId); if (obtDes != null) { obtDes.Obtained += designObt; await _designService.IncreaseQuantityAsync(obtDes.ComponentId, -designObt); await _db.ObtainedDesignRepository.UpdateAsync(obtDes); } await _db.SaveAsync(); }