public async Task AdaugaNotaAsyncTask(NotaEntity nota) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=storeksq6lvimcn6gy;AccountKey=okS17G921c6N5lN7Czxi1QJ+DF/fbripzaWiEDoRdp4oh42RoJFz3A5Nfn70dHaoh3mUaFzQIcu9MVDTeHmmiQ==;EndpointSuffix=core.windows.net"); // Create a table client for interacting with the table service CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); // Create a table client for interacting with the table service CloudTable table = tableClient.GetTableReference("notepssc"); await table.CreateIfNotExistsAsync(); var insertOperation = TableOperation.Insert(nota); await table.ExecuteAsync(insertOperation); }
private void button1_Click(object sender, EventArgs e) { string materie = textBox2.Text; int nota; try { nota = int.Parse(textBox1.Text); } catch { nota = -1; } if (nota >= 1 && nota <= 10 && !string.IsNullOrWhiteSpace(materie)) { NotaEntity notaEntity = new NotaEntity(Guid.NewGuid().ToString(), elev.Cnp); notaEntity.Materie = materie; notaEntity.Nota = nota; Task.Run(() => { MasterRepository.EleviRepository.AdaugaNotaAsyncTask(notaEntity); }); Close(); } else { MessageBox.Show("Nota trebuie sa fie intre 1 si 10"); } }
public async Task <List <NotaEntity> > All(string key = null, string value = null) { NotaEntity Nota; List <NotaEntity> Notas = new List <NotaEntity>(); if (String.IsNullOrEmpty(key) && String.IsNullOrEmpty(value)) { findAllNotaResponse Response = await this.Service.findAllNotaAsync(); foreach (nota p in Response.@return) { Nota = new NotaEntity(); Nota.Id_Nota = (int)p.idNota; Nota.Nota = p.nota1; Nota.Curso = await this.CursoService.Find((int)p.idCurso); Notas.Add(Nota); } return(Notas); } else { findNotaPorResponse Response = await this.Service.findNotaPorAsync(key, value); foreach (nota p in Response.@return) { Nota = new NotaEntity(); Nota.Id_Nota = (int)p.idNota; Nota.Nota = p.nota1; Nota.Curso = await this.CursoService.Find((int)p.idCurso); Notas.Add(Nota); } return(Notas); } }