Beispiel #1
0
        public IActionResult EditCollection(string id)
        {
            ObjectId oId = new ObjectId(id);

            BadgeCollections badge = BadgeCollections.Find(e => e.CollectionId == oId).FirstOrDefault();

            return(View(badge));
        }
Beispiel #2
0
        public IActionResult CreateCollection(BadgeCollections createCollection)
        {
            var UserId = User.Claims.FirstOrDefault(c => c.Type == AppUtility.UserId).Value;;

            createCollection.UserId = new ObjectId(UserId);
            this.BadgeCollections.InsertOne(createCollection);
            ObjectId id = createCollection.CollectionId;

            return(RedirectToAction("Collections", "Badge", new { id = createCollection.CollectionId }));
        }
Beispiel #3
0
        public IActionResult EditCollection(string id, BadgeCollections badgeCollections)
        {
            if (ModelState.IsValid)
            {
                ObjectId         oId    = new ObjectId(id);
                BadgeCollections badges = BadgeCollections.Find(e => e.CollectionId == oId).FirstOrDefault();
                var filter = Builders <BadgeCollections> .Filter.Eq("_id", oId);

                var updateDef = Builders <BadgeCollections> .Update.
                                Set("CollectionName", badgeCollections.CollectionName);

                updateDef = updateDef.Set("CollectionDescription", badgeCollections.CollectionDescription);
                BadgeCollections.UpdateOne(filter, updateDef);
            }
            return(RedirectToAction("Index"));
        }