Exemple #1
0
        public BooksQueueResponse ProcessManyBooksForMongo(IList <Book> message)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("-----------------Start ProcessManyBooksForMongo() ...-----------------");

            var ids = _pcRepository.BulkInsert <Book>(message);

            var predicate = MXPredicateBuilder.True <Book>();

            predicate = predicate.And(p => ids.Contains(p.Id));

            var entities = _pcRepository.GetMany <Book>(predicate, take: ids.Count);

            Console.WriteLine("\n-----------------Processing Complete..-----------------");
            Console.ResetColor();

            return(new BooksQueueResponse {
                Books = entities
            });
        }
        public JsonResult LoadDataForAutoComplete(string term)
        {
            try
            {
                var predicate = MXPredicateBuilder.True <ClientType>();

                predicate = predicate.And(p => p.Name.ToLower().Contains(term));

                var results = _repository.GetOptionSet <ClientType, DenormalizedReference>(predicate);

                var myData = results.Select(a => new SelectListItem()
                {
                    Text  = a.DenormalizedName,
                    Value = a.DenormalizedId,
                });

                return(Json(myData, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json("Error Occurred: " + ex.Message, JsonRequestBehavior.AllowGet));
            }
        }