コード例 #1
0
        static void Main(string[] args)
        {
            Scuola   scuola    = new Scuola("Rosselli_Rasetti");
            Classe   classe    = scuola.CreateClasse(4, "AI");
            Studente studente1 = new Studente("Nicola", "Galeotti");
            Studente studente2 = new Studente("Narcis", "Buzatu");

            classe.AddStudente(studente1);
            classe.AddStudente(studente2);
            Materia     materia1 = new Materia("Matematica");
            Valutazione voto1    = new Valutazione(8, studente1, materia1);
            Valutazione voto2    = new Valutazione(7, studente2, materia1);
            Valutazione votomax  = scuola.TrovaVotoMassimo();
            Valutazione votomin  = scuola.TrovaVotoMinimo();

            Console.WriteLine($"Il voto massimo della scuola {scuola.GetNome()} è {votomax.GetVotoDouble()}.");
            Console.WriteLine($"Il voto minimo della scuola {scuola.GetNome()} è {votomin.GetVotoDouble()}.");
        }
コード例 #2
0
        public async Task <IActionResult> Create(Valutazione model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(model);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Details", "Consulti", new { id = model.ConsultoId }));
                }
            }
            catch (DbUpdateException ex)
            {
                _logger.LogError(ex, "Valutazione creation failed");
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(model));
        }
コード例 #3
0
        public async Task <IActionResult> Create(int?consultoId)
        {
            if (consultoId == null)
            {
                return(NotFound());
            }

            var entity = await _context.Consulti
                         .SingleOrDefaultAsync(m => m.ID == consultoId);

            if (entity == null)
            {
                return(NotFound());
            }

            var model = new Valutazione {
                PazienteId = entity.PazienteId, ConsultoId = consultoId.Value
            };

            return(View(model));
        }
コード例 #4
0
 public IActionResult Put([FromBody]Valutazione contract) => Store(contract, EntityState.Modified);
コード例 #5
0
 public IActionResult Post([FromBody]Valutazione contract) => Store(contract, EntityState.Added);