public JsonResult GhostItemEdit(SnowItem form) { if (form.SnowItemID == 0) { form.AddDate = DateTime.Now; SnowItemRepository.Add(form); SnowItemRepository.Context.Commit(); return Json(form); } else { var SnowItem = SnowItemRepository.Find(Specification<SnowItem>.Eval(o => o.SnowItemID == form.SnowItemID)); SnowItem.SnowScore = form.SnowScore; SnowItem.SnowItemName = form.SnowItemName; SnowItem.SnowItemScale = form.SnowItemScale; SnowItemRepository.Update(SnowItem); SnowItemRepository.Context.Commit(); return Json(SnowItem); } }
public ActionResult GhostItemEdit(int SnowID, Guid? ID = null) { if (ID == null) { SnowItem Snowitem = new SnowItem(); Snowitem.SnowID = SnowID; Snowitem.Snow = SnowRepository.Find(Specification<Snow>.Eval(o => o.SnowID == SnowID)); return View(Snowitem); } else { var Snowitem = SnowItemRepository.GetByKey(ID); return View(Snowitem); } }