예제 #1
0
 private void Update_Click(object sender, EventArgs e)
 {
     using (MazalEntities context = new MazalEntities())
     {
         Scholarship scholarship = context.Scholarships.FirstOrDefault(s => s.Scholership_Name == "Perach");
         scholarship.Volunteer_hours++;
         context.SaveChanges();
     }
 }
예제 #2
0
 private void Remove_Click(object sender, EventArgs e)
 {
     using (MazalEntities context = new MazalEntities())
     {
         Scholarship scholarship = context.Scholarships.FirstOrDefault(s => s.Scholership_Name == "Nachshon");
         context.Scholarships.Remove(scholarship);
         context.SaveChanges();
     }
 }
예제 #3
0
        private void Insert_Click(object sender, EventArgs e)
        {
            using (MazalEntities context = new MazalEntities())
            {
                Scholarship nachshon = new Scholarship
                {
                    Scholership_ID       = "4",
                    Grant_Amount_shekel_ = 10000,
                    Scholership_Name     = "Nachshon",
                    Intended_for         = "Any",
                    Duration_years_      = 1,
                    Volunteer_hours      = 150
                };

                context.Scholarships.Add(nachshon);
                context.SaveChanges();
            }
        }