private void update_Click(object sender, EventArgs e) { tb = db.Tables.where (x => x.id == 1).firstOrDefault(); Entry(); db.SaveChanges(); MessageBox.Show("UPDATED"); }
private table1 get_infor_allday(int start, int stop, bool display) { if (display) { table2BindingSource.Clear(); } table2 tb; TimeSpan timesum = new TimeSpan(0, 0, 0); for (int i = start + 1; i <= stop; i++) { if (doc[i].Date != doc[i - 1].Date) { tb = get_info_1day(start, display); start = i; timesum = timesum.Add(tb.TimePerDay); } } tb = get_info_1day(start, display); // calcu timesum timesum = timesum.Add(tb.TimePerDay); string timesum_string = string.Format("{0}:{1}:{2}", (int)timesum.TotalHours, timesum.Minutes, timesum.Seconds); table1 tb1 = new table1(); tb1.Name = doc[start].Name; tb1._id = doc[start]._id; tb1.All_of_time = timesum_string; return(tb1); }
public ActionResult DeleteConfirmed(string id) { table1 table1 = db.table1.Find(id); db.table1.Remove(table1); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Test1/Delete/5 public ActionResult Delete(string id = null) { table1 table1 = db.table1.Find(id); if (table1 == null) { return(HttpNotFound()); } return(View(table1)); }
public ActionResult Edit(table1 table1) { if (ModelState.IsValid) { db.Entry(table1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(table1)); }
public ActionResult Create(table1 table1) { if (ModelState.IsValid) { db.table1.Add(table1); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(table1)); }
public async Task <Object> puttable1(string FirstName, table1 table1) { if (FirstName != table1.FirstName) { return(BadRequest()); } ClientContext.Entry(table1).State = EntityState.Modified; try { await ClientContext.SaveChangesAsync(); } catch { } return(Ok()); }
static void Main(string[] args) { using (var context = new db_test_1Entities()) { table1 lul = new table1(); lul.name = "Hola2"; var query = context.table1.Find(2); //foreach(var row in query) //{ // Console.WriteLine(row.name); //} Console.WriteLine(query.id + " - " + query.name); context.table1.Add(lul); context.SaveChanges(); } Console.WriteLine("holiz"); Console.ReadLine(); }