public async Task <ActionResult <Assuntos> > PostAssuntos(Assuntos assuntos) { _context.Assuntos.Add(assuntos); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAssuntos", new { id = assuntos.idAssunto }, assuntos)); }
public async Task <IActionResult> PutAssuntos(int id, Assuntos assuntos) { if (id != assuntos.idAssunto) { return(BadRequest()); } _context.Entry(assuntos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssuntosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void AdicionarAssunto(Guid assuntoId) { Assuntos.Add(PlanoTrabalhoAtividadeAssunto.Criar(this.PlanoTrabalhoAtividadeId, assuntoId)); }
public void RemoverAssunto(Guid assuntoId) { Assuntos.RemoveAll(a => a.AssuntoId == assuntoId); }
public Assuntos ConsultaAssuntoAtividade(string Tipo) { Assuntos _Retorno = new Assuntos(); try { using (HanaConnection conn = new HanaConnection(ConfigurationManager.ConnectionStrings["Hana"].ConnectionString)) { conn.Open(); var Schema = ConfigurationManager.AppSettings["CompanyDB"]; string Sql = string.Format(Properties.Resources.ConsultaAssuntoAtividade, Schema, Tipo); using (HanaCommand cmd3 = new HanaCommand(Sql, conn)) { using (HanaDataReader productInfoReader3 = cmd3.ExecuteReader()) { HanaCommand cmd = new HanaCommand(Sql, conn); HanaDataReader productInfoReader = cmd.ExecuteReader(); if (productInfoReader.HasRows) { productInfoReader.Read(); string Code = productInfoReader.GetString(0); string Name = productInfoReader.GetString(1); string Count = productInfoReader.GetString(2); _Retorno.value = new Assunto[int.Parse(Count)]; _Retorno.value[0] = new Assunto(); _Retorno.value[0].Code = Code; _Retorno.value[0].Name = Name; int i = 1; while (productInfoReader.Read()) { Code = productInfoReader.GetString(0); Name = productInfoReader.GetString(1); _Retorno.value[i] = new Assunto(); _Retorno.value[i].Code = Code; _Retorno.value[i].Name = Name; i++; } } } } } } catch (Exception ex) { Log.Error(ex.Message); } finally { } return(_Retorno); }