public ActionResult Create(Badge badge) { if (ModelState.IsValid) { badge.Id = WebSecurity.CurrentUserId;//User.Identity ds.Create(badge); return RedirectToAction("Index"); } return View(badge); }
//If a change is being made to an existing badge, this will modify it. public void Update(Badge badge) { dc.Entry(badge).State = EntityState.Modified; dc.SaveChanges(); }
//If a badge needs to be created, this will create the specified badge with certain required properties public void Create(Badge badge) { dc.Badges.Add(badge); dc.SaveChanges(); }
public ActionResult Edit(Badge badge) { if (ModelState.IsValid) { ds.Update(badge); return RedirectToAction("Index"); } return View(badge); }