// 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)); }
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; } }
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)); }
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);; }
public void Post(NewsDto post) { solrIndexService.AddUpdate(new SolrNewsEntity(post)); }