public ActionResult AggiornaQuota(QuotaAcquistata model) { if (ModelState.IsValid) { var quota = db.QuoteAcquistate.First(x => x.PartecipanteID == model.PartecipanteID && x.QuotaPartecipazioneID == model.QuotaPartecipazioneID); quota.Versato = model.Versato; db.SaveChanges(); } return(RedirectToAction("Quote", new { id = model.PartecipanteID })); }
public ActionResult AggiungiQuota(PartecipanteAggiungiQuotaModel model) { var partecipante = db.Partecipanti.Find(model.PartecipanteID); foreach (var item in model.QuoteDaAcquistare.Where(x => x.Aggiungi)) { var quota = new QuotaAcquistata { QuotaPartecipazioneID = item.ID, PartecipanteID = partecipante.ID, }; partecipante.QuoteAcquistate.Add(quota); } db.SaveChanges(); return(RedirectToAction("Quote", new { id = partecipante.ID })); }