public async Task <IActionResult> Edit(int id, [Bind("CollectorId,ItemId")] CollectionObj collectionObj)
        {
            if (id != collectionObj.CollectorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(collectionObj);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CollectionObjExists(collectionObj.CollectorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CollectorId"] = new SelectList(_context.Collector, "CollectorId", "CollectorId", collectionObj.CollectorId);
            ViewData["ItemId"]      = new SelectList(_context.Item, "ItemId", "ItemId", collectionObj.ItemId);
            return(View(collectionObj));
        }
예제 #2
0
 public void CommitSnapshot()
 {
     if (_collection != null)
     {
         CollectionObj.CommitSnapshot();
     }
 }
예제 #3
0
 public void RevertToPreviousState()
 {
     if (_collection != null)
     {
         CollectionObj.RevertToPreviousState();
     }
 }
예제 #4
0
 public void CreateSnapshot()
 {
     // Delegate the call to the collection itself; if the collection is not
     // loaded yet, it will be loaded now.
     // If the collection is not loaded yet, we do not want to create the snapshot.
     if (_collection != null)
     {
         CollectionObj.CreateSnapshot();
     }
 }
        public async Task <IActionResult> Create([Bind("CollectorId,ItemId")] CollectionObj collectionObj)
        {
            if (ModelState.IsValid)
            {
                _context.Add(collectionObj);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CollectorId"] = new SelectList(_context.Collector, "CollectorId", "CollectorId", collectionObj.CollectorId);
            ViewData["ItemId"]      = new SelectList(_context.Item, "ItemId", "ItemId", collectionObj.ItemId);
            return(View(collectionObj));
        }
예제 #6
0
    public virtual void Init(GameObject owner)
    {
        if (owner == null)
        {
            return;
        }
        Owner = owner;
        SetBindNode(Owner, BIND_NAME);

        CollectionObj obj = Owner.GetComponent <CollectionObj>();

        if (obj == null)     //测试时
        {
            NameText.text = "test";
            return;
        }
        NameText.text = obj.Name;
    }
예제 #7
0
 public void ClearDeleted()
 {
     CollectionObj.ClearDeleted();
 }
예제 #8
0
 public void RemoveAt(int index)
 {
     CollectionObj.RemoveAt(index);
 }
예제 #9
0
 public ReadOnlyCollection <T> AsReadOnly()
 {
     return(CollectionObj.AsReadOnly());
 }
예제 #10
0
 public T[] ToArray()
 {
     return(CollectionObj.ToArray());
 }
예제 #11
0
 public void Remove(T item)
 {
     CollectionObj.Remove(item);
 }
예제 #12
0
 public void Insert(int index, T item)
 {
     CollectionObj.Insert(index, item);
 }
예제 #13
0
 public void Add(T item)
 {
     CollectionObj.Add(item);
 }