Example #1
0
        public void DeletePlan(int id)
        {
            var db   = new PlanEntities();
            var plan = db.dplans.Find(id);

            db.dplans.Remove(plan);
            db.SaveChanges();
        }
Example #2
0
        public void EditPlan(int id, string note, string plan, string time, bool progress, DateTime date)
        {
            var db      = new PlanEntities();
            var oldPlan = db.dplans.Find(id);

            oldPlan.Date     = date;
            oldPlan.Note     = note;
            oldPlan.Plan     = plan;
            oldPlan.Time     = time;
            oldPlan.Progress = progress;

            db.Entry(oldPlan).State = System.Data.EntityState.Modified;
            db.SaveChanges();
        }
Example #3
0
        public void AddPlan(string plan, string note, string time, bool progress, DateTime date)
        {
            var newPlan = new dplan();

            newPlan.Note     = note;
            newPlan.Plan     = plan;
            newPlan.Time     = time;
            newPlan.Progress = progress;
            newPlan.Date     = date;

            var db = new PlanEntities();

            db.dplans.Add(newPlan);
            db.SaveChanges();
        }
Example #4
0
        public dplan GetPlan(int id)
        {
            var db = new PlanEntities();

            return(db.dplans.Find(id));
        }
Example #5
0
        public dplan[] GetPlans()
        {
            var db = new PlanEntities();

            return(db.dplans.ToArray());
        }