public HttpResponseMessage CreateCompany([FromBody] CompanyEntity companyEntity) { HttpResponseMessage response = new HttpResponseMessage(); try { MongoHelper.MongoHelper _mongoHelperobj = new MongoHelper.MongoHelper("TalentTopper"); List <CompanyEntity> companyMasterList = new List <CompanyEntity>(); companyMasterList.Add(companyEntity); bool data = _mongoHelperobj.InsertMany("CompanyMaster", companyMasterList); if (data) { return(response = Request.CreateResponse(HttpStatusCode.OK, data)); } else { return(response = Request.CreateResponse(HttpStatusCode.NotFound, "Unable to save data")); } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage EditBranch([FromBody] BranchEntity branchEntity) { HttpResponseMessage response = new HttpResponseMessage(); try { MongoHelper.MongoHelper _mongoHelperobj = new MongoHelper.MongoHelper("TalentTopper"); //FilterDefinition<BsonDocument> filter = "_id:"+ branchEntity.id; FilterDefinition <BsonDocument> filter = new BsonDocument("_id", branchEntity.BsonId); bool data = _mongoHelperobj.UpdateOne("BranchMaster", filter, branchEntity.ToBsonDocument()); if (data) { return(response = Request.CreateResponse(HttpStatusCode.OK, data)); } else { return(response = Request.CreateResponse(HttpStatusCode.NotFound, "Unable to save data")); } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }