Skip to content

Instantly share code, notes, and snippets.

using MongoDB.Driver;
using System;
namespace mvcMongoDB.Models
{
public class CountryDB
{
//For Best practice, Please put this in the web.config. This is only for demo purpose.
//====================================================
public String connectionString = "mongodb://localhost";
<div class="modal-header">
<button type="button" class="close" ng-click="cancel()" aria-hidden="true">&times;</button>
<h3 class="modal-title">Delete {{contact.firstName}} {{contact.lastName}}</h3>
</div>
<div class="modal-body">
<div class="container">
<form class="form-horizontal" role="form" id="contactForm" name="contactForm">
<!--<div class="col-sx-12 col-sm-8 col-md-6 col-lg-6">-->
<div class="form-group">
$routeProvider.when('/mycontacts/newcontact', {
templateUrl: "app/contact/html/contactForm.html",
controller: "contactAddController"
}),
$routeProvider.when('/mycontacts/:id', {
templateUrl: "app/contact/html/contactForm.html",
controller: "contactEditController"
}),
<table class="table table-striped">
<thead>
<tr>
<td>Last Name</td>
<td>First Name</td>
<td>Email</td>
<td>Mobile</td>
<td></td>
</tr>
</thead>
<div class="panel panel-primary">
<div class="panel-heading">Contact Form</div>
<div class="panel-body">
<form class="form-horizontal" role="form" id="contactForm" name="contactForm">
<div class="form-group">
<label for="firstName" class="col-sm-3 control-label">First Name</label>
<div class="col-sm-6">
contactApp.controller('contactController',
['$scope', 'contactDataService', '$location',
function categoryController($scope, contactDataService) {
$scope.contacts = [];
loadContactData();
function loadContactData() {
contactDataService.getContacts()
.then(function () {
contactApp.factory('contactDataService', ['$http', '$q',
function ($http, $q) {
var _contacts = [];
var _getContacts = function () {
var deferred = $q.defer();
var controllerQuery = "contact/GetContacts";
$http.get(controllerQuery)
.then(function (result) {
using Contacts.Helpers;
using Contacts.Models;
using System.Web.Mvc;
using System.Linq;
using System.Net;
namespace Contacts.Controllers
{
public class ContactController : JsonController
{
bundles.Add(new ScriptBundle("~/bundles/angularApp").Include(
"~/Scripts/Angular1.3.5/angular.js",
"~/Scripts/Angular1.3.5/angular-route.js",
"~/Scripts/Angular1.3.5/angular-resource.js",
"~/Scripts/Angular1.3.5/angular-ui-bootstrap.js",
"~/App/contactApp.js",
"~/App/clientRoute.js",
"~/App/DataService/contactDataService.js",
"~/App/contact/controller/contactController.js"
));