Beispiel #1
0
        // https://github.com/SolrNet/SolrNet/blob/master/Documentation/CRUD.md
        public IActionResult Create()
        {
            PhotoSearch post = new PhotoSearch();

            post.PhotoId = "3410687";
            post.Name    = new string[] { "New Added " + DateTime.Now };
            solr.AddUpdate(post);

            SolrQueryResults <PhotoSearch> results = solr.GetAll();

            return(View("index", results));
        }
Beispiel #2
0
        public NewsDto Insert(NewsDto dto)
        {
            NewsEntity model = new NewsEntity(dto);

            try
            {
                _Db.CreateTransaction();
                _Db.Insert(model);
                _Db.Commit();


                SolrNewsEntity document    = new SolrNewsEntity(dto);
                bool           SolrUpdated = _Solr.AddUpdate(document);
                if (!SolrUpdated)
                {
                    _Db.Rollback();
                }
                else
                {
                    _Db.Save();
                    _Solr.Save();
                }

                return(new NewsDto(model));
            }
            catch (Exception err)
            {
                _Solr.RollBack();
                _Db.Rollback();
                throw err;
            }
        }
Beispiel #3
0
        public void Create11(Post model)
        {
            var mypost_Data = new Post();

            mypost_Data.Id       = "000100";
            mypost_Data.IsActive = false;

            mypost_Data.Price = 101;

            mypost_Data.Title  = "TEsting DATA";
            mypost_Data.IsSold = DateTime.Today;
            _solrIndexService.AddUpdate(new SolrPostModel(model));
        }
Beispiel #4
0
        public void Post([FromBody] Post post)
        {
            postDbContext.Add(post);
            int id        = postDbContext.SaveChanges();
            var postModel = new PostModel
            {
                Id          = id.ToString(),
                IsActive    = post.IsActive,
                Description = post.Description,
                Price       = post.Price,
                Title       = post.Title
            };

            solrIndexService.AddUpdate(postModel);;
        }
Beispiel #5
0
 public void Post(NewsDto post)
 {
     solrIndexService.AddUpdate(new SolrNewsEntity(post));
 }