Пример #1
0
        public ActionResult Create(Badge badge)
        {
            if (ModelState.IsValid)
            {
                badge.Id = WebSecurity.CurrentUserId;//User.Identity
                ds.Create(badge);
                return RedirectToAction("Index");
            }

            return View(badge);
        }
Пример #2
0
 //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();
 }
Пример #3
0
 //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();
 }
Пример #4
0
 public ActionResult Edit(Badge badge)
 {
     if (ModelState.IsValid)
     {
         ds.Update(badge);
         return RedirectToAction("Index");
     }
     return View(badge);
 }