public ActionResult Edit(Browser browser) { if (ModelState.IsValid) { context.Entry(browser).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } return View(browser); }
public void InsertOrUpdate(Browser browser) { if (browser.Id == default(int)) { // New entity context.Browsers.Add(browser); } else { // Existing entity context.Entry(browser).State = EntityState.Modified; } }
public ActionResult Create(Browser browser) { if (ModelState.IsValid) { context.Browsers.Add(browser); context.SaveChanges(); return RedirectToAction("Index"); } return View(browser); }
public bool SaveBrowser(string browserName, string browserVersion, string browserPlatform, string clientIP) { Browser browser = new Browser(); browser.Name = browserName; browser.Version = browserVersion; browser.Platform = browserPlatform; browser.ClientIP = clientIP; browser.TimeStamp = DateTime.Now; context.Browsers.Add(browser); context.SaveChanges(); return true; }