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); }
// 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); } }