Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoIorio11 committed Jun 20, 2022
1 parent 64593bc commit 827e591
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Binary file modified Hospital/.vs/Hospital/v16/TestStore/0/000.testlog
Binary file not shown.
5 changes: 3 additions & 2 deletions Hospital/Hospital/Controllers/InterventiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ActionResult Create(intervento intervento)
{
string[] id_tipologie = ModelState["tipologias"].Value.AttemptedValue.Split(',');
var tipologie = this.AddTipologie(id_tipologie);
if(this.CheckTipologia(tipologie, chirurghi))
if(!this.CheckTipologia(tipologie, chirurghi))
{
TempData["FailMessage"] = "Intervento non aggiunto ";
return RedirectToAction("Index");
Expand Down Expand Up @@ -109,7 +109,8 @@ public ActionResult Create(intervento intervento)

private bool CheckTipologia(List<tipologia> tipologie, List<chirurgo> chirurgo)
{
return tipologie.Any(tipo => chirurgo.Any(ch => ch.tipologias.Any(tipol => tipol.IdTipologia != tipo.IdTipologia)));
// Tutte le tipologie dell intervento che si devono creare devono essere contenute nei vari chirurghi
return tipologie.All(tipo => chirurgo.All(ch => ch.tipologias.Contains(tipo)));
}

public List<chirurgo> AddChirurghi(string[] ids)
Expand Down

0 comments on commit 827e591

Please sign in to comment.