예제 #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            table2 table2 = db.table2.Find(id);

            db.table2.Remove(table2);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "topings,subs,size")] table2 table2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(table2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(table2));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "topings,subs,size")] table2 table2)
        {
            if (ModelState.IsValid)
            {
                db.table2.Add(table2);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(table2));
        }
예제 #4
0
파일: Form1.cs 프로젝트: paulbao297/app
        private table2 get_info_1day(int start, bool display)
        {
            string Date    = "";
            string InTime  = "";
            string OutTime = "";
            string Name    = "";

            int stop = start;

            while (stop + 1 < doc.Count() - 1) // make sure that same name same date to calcu time
            {
                if (doc[stop + 1].Name != doc[start].Name)
                {
                    break;
                }
                if (doc[stop + 1].Date != doc[start].Date)
                {
                    break;
                }
                stop++;
            }

            DateTime In;
            DateTime Out;
            table2   tb;
            //insert tab1
            table1   tb1;
            TimeSpan TimeSet;
            TimeSpan Time_Sub;
            TimeSpan Time_After_Set;

            InTime  = doc[start].Time;
            OutTime = doc[stop].Time;
            In      = Convert.ToDateTime(InTime);
            Out     = Convert.ToDateTime(OutTime);

            tb             = new table2();
            tb.Date        = doc[start].Date;
            tb.InTime      = InTime;
            tb.OutTime     = OutTime;
            TimeSet        = new TimeSpan(01, 00, 00); //off 1h midday
            Time_Sub       = Out.Subtract(In);
            Time_After_Set = Time_Sub.Subtract(TimeSet);
            tb.TimePerDay  = Time_After_Set;
            int x = (int)Time_After_Set.TotalHours; // convert timespan/day to int

            if (display)
            {
                table2BindingSource.Add(tb);  //display on datagridview 2 - table 1
            }
            return(tb);
        }
예제 #5
0
        // GET: table2/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            table2 table2 = db.table2.Find(id);

            if (table2 == null)
            {
                return(HttpNotFound());
            }
            return(View(table2));
        }
예제 #6
0
        public async Task <Object> puttable2(string FirstName, table2 table2)
        {
            if (FirstName != table2.FirstName)
            {
                return(BadRequest());
            }

            ClientContext.Entry(table2).State = EntityState.Modified;

            try
            {
                await ClientContext.SaveChangesAsync();
            }
            catch
            {
            }
            return(Ok());
        }