Пример #1
0
 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");
 }
Пример #2
0
 /// <summary>
 /// 用于向 Resources EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToResources(Resource resource)
 {
     base.AddObject("Resources", resource);
 }
Пример #3
0
 public ActionResult Edit(Resource vegetable)
 {
     var mode = iGenericRepository.Update(vegetable);
     return RedirectToAction("Index");
 }
Пример #4
0
 /// <summary>
 /// 创建新的 Resource 对象。
 /// </summary>
 /// <param name="resourceID">ResourceID 属性的初始值。</param>
 /// <param name="resourcName">ResourcName 属性的初始值。</param>
 /// <param name="f_ResourceID">F_ResourceID 属性的初始值。</param>
 public static Resource CreateResource(global::System.Guid resourceID, global::System.String resourcName, global::System.Guid f_ResourceID)
 {
     Resource resource = new Resource();
     resource.ResourceID = resourceID;
     resource.ResourcName = resourcName;
     resource.F_ResourceID = f_ResourceID;
     return resource;
 }