public ActionResult Delete(string id) { EsClient es = new EsClient(); if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } return View(_eq.IdDetails(id)); }
public ActionResult Create([Bind(Include = "Id,ExtractName,Description,DescriptionHtml,Requestor,RequestorEmail,DataSources,DataExtractDetails,ClusterStorageLocation,ClusterStoragePath,StartDate")] HadoopMetaDataModels hadoopMetaDataModels) { // instantiate elastic client from data access layer EsClient es = new EsClient(); hadoopMetaDataModels.Id = Guid.NewGuid().ToString(); // TODO: Reduce to function? // create index; index doesn't exist es.Current.CreateIndex(ci => ci.Index("hadoop_metadata") .AddMapping<HadoopMetaDataModels>(m => m .MapFromAttributes())); // index does exist; apply index for inserts; builds as per document(model) var response = es.Current.Map<HadoopMetaDataModels>(m => m.MapFromAttributes() .Type<HadoopMetaDataModels>() .Indices("hadoop_metadata")); // set description(without html) to model.Description hadoopMetaDataModels.Description = TextParseHelper.StripHtml(hadoopMetaDataModels.DescriptionHtml); //ModelState.SetModelValue("Description", new ValueProviderResult(description, "", CultureInfo.InvariantCulture)); ModelState.Clear(); if (ModelState.IsValid) { es.Current.Index<HadoopMetaDataModels>(hadoopMetaDataModels); return RedirectToAction("Index"); } return View(hadoopMetaDataModels); }