Example #1
0
        public JsonResult FightItemEdit(FightItem form)
        {
            if (form.FightItemID == 0)
            {
                form.AddDate = DateTime.Now;
                FightItemRepository.Add(form);
                FightItemRepository.Context.Commit();
                return Json(form);
            }
            else
            {
                var FightItem = FightItemRepository.Find(Specification<FightItem>.Eval(o => o.FightItemID == form.FightItemID));

                FightItem.FightItemName = form.FightItemName;
                FightItem.FightItemAnswers = form.FightItemAnswers;
                FightItem.FightItemTrueAnswer = form.FightItemTrueAnswer;
                FightItemRepository.Update(FightItem);
                FightItemRepository.Context.Commit();
                return Json(FightItem);
            }
        }
Example #2
0
 public ActionResult FightItemEdit(int FightID, Guid? ID = null)
 {
     if (ID == null)
     {
         FightItem Fightitem = new FightItem();
         Fightitem.FightID = FightID;
         return View(Fightitem);
     }
     else
     {
         var Fightitem = FightItemRepository.GetByKey(ID);
         return View(Fightitem);
     }
 }