public ActionResult Create(Resource resource) { ReturnObj returnObj = new ReturnObj(); resource.ResourceID = Guid.NewGuid(); resource.State = "0"; resource.ReType = "1"; if (iGenericRepository.GetById(resource.ResourceID) == null) { resource.AddTime = DateTime.Now; resource.AddUserID = Guid.Parse(Session["UiLoginId"].ToString()); if (iGenericRepository.Save(resource) > 0) { returnObj.State = 1; returnObj.Msg = "保存成功!"; } else { returnObj.State = -1; returnObj.Msg = "保存失败!"; } } else { returnObj.State = -1; returnObj.Msg = "已存在"; } return RedirectToAction("Index"); }
public ActionResult Edit(Resource vegetable) { var mode = iGenericRepository.Update(vegetable); return RedirectToAction("Index"); }