Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("DiseaseId,DiseaseName")] DiseaseTable diseaseTable)
        {
            if (id != diseaseTable.DiseaseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(diseaseTable);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DiseaseTableExists(diseaseTable.DiseaseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(diseaseTable));
        }
Example #2
0
        private void SaveDiseaseButton_Click(object sender, EventArgs e)
        {
            DbConnector db = DbConnector.GetInstance();

            for (int i = 0; i < DiseaseTable.RowCount; i++)
            {
                dis[i].Name = DiseaseTable.GetControlFromPosition(0, i).Text;
                db.UpdateType(dis[i], "disease");
            }
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("DiseaseId,DiseaseName")] DiseaseTable diseaseTable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(diseaseTable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(diseaseTable));
        }
Example #4
0
 public void LoadEntriesDisease()
 {
     dis = DbConnector.GetInstance().GetDiseaseTypes();
     DiseaseTable.Controls.Clear();
     DiseaseTable.RowCount = dis.Count;
     DiseaseTable.Update();
     for (int i = 0; i < dis.Count; i++)
     {
         TextBox      lb = new TextBox(); lb.Font = new Font("Calibri", 12); lb.Text = dis[i].Name; lb.Show();
         DeleteButton b3 = new DeleteButton(dis[i].id, "diseasetype");
         b3.Click += b3_Click;
         this.DiseaseTable.Controls.Add(lb, 0, i);
         this.DiseaseTable.Controls.Add(b3, 1, i);
     }
 }