public ActionResult Create(ContentPageModels ccontentPage) { ccontentPage.date_article = DateTime.Today.Date; db.Entry(ccontentPage).State = EntityState.Added; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { ContentPageModels b = db.ContentPage.Find(id); if (b == null) { return(HttpNotFound()); } return(View(b)); }
public ActionResult DeleteConfirmed(int id) { ContentPageModels b = db.ContentPage.Find(id); if (b == null) { return(HttpNotFound()); } db.ContentPage.Remove(b); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditArtical(int?id) { if (id == null) { return(HttpNotFound()); } ContentPageModels Page = db.ContentPage.Find(id); if (Page != null) { return(View(Page)); } return(HttpNotFound()); }
// GET api/<controller>/5 public string Get(string id) { //Find to mac if (id == null) { return("Error id is null"); } List <DeviceModels> device = db.Devices.ToList(); foreach (var x in device) { if (x.macadress == id) { x.last_activ_time = DateTime.Today.Date; x.status = "djeronimo"; x.type_device = "test"; db.Entry(x).State = EntityState.Modified; } } // device.last_activ_time = DateTime.Today.Date; // device.status = "ok"; // device.type_device = "test"; // db.Entry(device).State = EntityState.Modified; db.SaveChanges(); //end find string idd = id.ToString(); string timing = DateTime.Today.ToShortTimeString(); ContentPageModels ccontentPage = new ContentPageModels(); ccontentPage.date_article = DateTime.Today.Date; ccontentPage.content_text = "Odio+" + idd; ccontentPage.content_article = "gvileske on web " + timing + " now"; db.Entry(ccontentPage).State = EntityState.Added; db.SaveChanges(); return("value"); }
public ActionResult EditArtical(ContentPageModels contentPage) { db.Entry(contentPage).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }