// // GET: /Entregas/ public ActionResult Index(string id) { // Get remarks by id var caixaAzul = MongoWrapper.GetDatabase(). GetCollection("caixaAzul"). FindOneByIdAs <CaixaAzul>(ObjectId.Parse(id)); return(View(caixaAzul)); }
// // GET: /CaixaAzul/ public ActionResult Index() { // Get all users by sorting by createdate var caixaAzul = MongoWrapper.GetDatabase(). GetCollection("caixaAzul"). FindAll(). SetSortOrder(SortBy.Descending("createdate")); return(View(caixaAzul)); }
public ActionResult Edit(string id) { // Obtain id compatible with MongoDB to query var objectId = ObjectId.Parse(id); // Get user by id var caixaAzul = MongoWrapper.GetDatabase(). GetCollection("caixaAzul"). FindOneByIdAs <CaixaAzul>(ObjectId.Parse(id)); return(View(caixaAzul)); }
public void InsertMockCaixaAzul_2() { System.Diagnostics.Debug.WriteLine("Testing Inser Mock"); int numCaixa = 17; string cnpjProvider = "22222222222222"; // Get user collection reference var caixaAzulDb = MongoWrapper.GetDatabase().GetCollection("caixaAzul"); // Create BsonDocument object for new user var caixaAzul = new BsonDocument(); caixaAzul["numeroCaixa"] = numCaixa; caixaAzul["cnpjCD"] = cnpjProvider; // Insert new user object to collection caixaAzulDb.Insert(caixaAzul); }
public ActionResult Edit(string id, CaixaAzul caixaAzulToEdit) { // Get user collection reference var caixaAzulDB = MongoWrapper.GetDatabase().GetCollection("caixaAzul"); // Update user by id var caixaAzul = caixaAzulDB.FindOneById(ObjectId.Parse(id)); caixaAzul["numeroCaixa"] = caixaAzulToEdit.numeroCaixa; caixaAzul["cnpjCD"] = caixaAzulToEdit.cnpjCD; // Update user object caixaAzulDB.Save(caixaAzul); return(RedirectToAction("Index")); }
public ActionResult New(string id, CaixaAzul caixaAzulToEdit) { // Get user collection reference var caixaAzulDb = MongoWrapper.GetDatabase().GetCollection("caixaAzul"); // Create BsonDocument object for new user var caixaAzul = new BsonDocument(); caixaAzul["numeroCaixa"] = caixaAzulToEdit.numeroCaixa; caixaAzul["cnpjCD"] = caixaAzulToEdit.cnpjCD; //caixaAzul["entrega"] = caixaAzulToEdit.entrega; //CaixaAzul["createdate"] = DateTime.Now; // Insert new user object to collection caixaAzulDb.Insert(caixaAzul); return(RedirectToAction("Index")); }
public ActionResult Index(string id, string codEntrega, string faturado) { var caixaAzul = MongoWrapper.GetDatabase().GetCollection("caixaAzul"); var caixaAzulOne = caixaAzul.FindOneById(ObjectId.Parse(id)); var entrega = new BsonDocument(). Add("codigoEntrega", codEntrega). Add("faturado", faturado); if (caixaAzulOne.Contains("entregas")) { caixaAzulOne["entregas"].AsBsonArray.Add(BsonValue.Create(entrega)); } else { caixaAzulOne["entregas"] = new BsonArray().Add(BsonValue.Create(entrega)); } caixaAzul.Save(caixaAzulOne); return(RedirectToAction("Index", new { id = id })); }
public void GetDatabase_ShouldReturnSuccessfully() { //TODO: Find a way to validate the database creation var database = _mongoWrapper.GetDatabase(); }