Exemple #1
0
        public bool AddDate(Models.ContextTable model)
        {
            var date = model;

            using (Models.School_TestEntities entites = new Models.School_TestEntities())
            {
                entites.ContextTable.Add(date);
                if (entites.SaveChanges() > 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #2
0
        // PUT api/values/5
        public bool UpdateDate(Models.ContextTable datemodel)
        {
            // var date = JsonConvert.DeserializeObject<Models.ContextTable>(value);
            using (Models.School_TestEntities entites = new Models.School_TestEntities())
            {
                var model = entites.ContextTable.Where(a => a.ID == datemodel.ID).FirstOrDefault();
                model.Title   = datemodel.Title;
                model.AddTime = datemodel.AddTime;
                model.Context = datemodel.Context;

                if (entites.SaveChanges() > 0)
                {
                    return(true);
                }
                return(false);
            }
        }