Sam's Dynamics, Power Platform & AI Blog

Tuesday, 17 January 2017

Important Links

C#:-
http://stackoverflow.com/questions/4528712/what-is-a-irepository-and-what-is-it-used-for
Enabling CRUD Operations in ASP.NET Web API 1
https://www.asp.net/web-api/overview/older-versions/creating-a-web-api-that-supports-crud-operations
Consuming a Web API Asynchronously in ASP.NET MVC or WPF
http://www.dotnetcurry.com/aspnet/1192/aspnet-web-api-async-calls-mvc-wpf
Seed Database in Code-First:
http://www.entityframeworktutorial.net/code-first/seed-database-in-code-first.aspx
2D array
https://www.dotnetperls.com/2d
Building your first ASP.NET Core MVC app with Visual Studio
https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/
Private Access Specifiers (C#)
http://www.completecsharptutorial.com/basic/private/

https://shivadotnetjavaphptech.wordpress.com/enter-your-zip-code-here/
Token Based Authentication using ASP.NET Web API 2, Owin, and Identity
http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/
Multiple File Upload Using HTML5, jQuery Ajax and Asp.Net Web API 
http://www.encodedna.com/webapi/multiple-file-upload-using-html5-jquery-ajax-webapi.htm
Search based on keyword in ASP.NET MVC
http://techfunda.com/howto/285/search-based-on-keyword
Search Functionality in ASP.NET MVC 4
https://www.mindstick.com/Articles/1141/search-functionality-in-asp-dot-net-mvc-4
http://stackoverflow.com/questions/4015324/http-request-with-post
http://stackoverflow.com/questions/1502500/how-to-use-webrequest-to-post-data-and-get-response-from-a-webpage
All C# Hard Code
http://sourcebrowser.io/Browse/aspnetboilerplate/aspnetboilerplate/src/Tests/Abp.Tests/Dependency/Circular_Constructor_Dependency_Tests.cs


Async Query and Save (EF6 onwards)

//////////////////////////////////*********************/////////////////////////////////////////

Angular JS:- 


AngularJS Tutorial

http://tutorials.jenkov.com/angularjs/index.html


Tree Structure

http://jsfiddle.net/eu81273/8LWUc/18/


LocalStorage and SessionStorage example

http://www.aspsnippets.com/Articles/AngularJS-LocalStorage-and-SessionStorage-example.aspx

AngularJS Dropdown Multiselect

http://dotansimha.github.io/angularjs-dropdown-multiselect/#/

AngularJS Drag-n-Drop Image Upload

https://codepen.io/whusterj/pen/ijFgA
FileUploader
https://jsfiddle.net/alexk111/rw6q9/

Add number of days to today's date

http://stackoverflow.com/questions/3818193/how-to-add-number-of-days-to-todays-date


Get Latitude Longitude

https://jsfiddle.net/alvaroAV/qn8bb8q5/


AngularJS Factory ,Service ,Provider

http://jsbin.com/lavavobefo/edit?html,console,output

Adding Multiple Points to Google Map with JavaScript

http://www.codescratcher.com/javascript/adding-multiple-points-google-map-javascript/

AngularJs Dynamic Data Table(Grid)

http://www.bootply.com/CGUoH7Gm0z



/***********************************************************************************************************/

EXPLORING MICROSOFT’S ADXSTUDIO PORTALS: PART 4
--/*************************************************////////****************************************

NodeJS:-

https://naltatis.github.io/jade-syntax-docs/ 

JQuery:- 
Graph
http://jsfiddle.net/gh/get/jquery/1.7.2/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-zindex/

Radio Buttons Checkbox Buttons

http://jsfiddle.net/y4tzfk0g/
Create New CheckBox
http://jsfiddle.net/SpYk3/b4jpmkw6/6/




Remove Space

http://jsfiddle.net/Rkb57/

Datagrid

https://www.ag-grid.com/

/********************************************************************************************************/

SSIS:-

CAML QUERY IN SHAREPOINT 

https://ranaomerhussain.wordpress.com/2015/03/09/caml-query-in-sharepoint-2013-examples/
Learn Sharepoint Step by Step ( Sharepoint tutorial)
https://www.youtube.com/watch?v=C2fW76SwJNU&t=21s

SharePoint Designer Tutorials, Tips and Tricks

http://sharepoint-tutorial.net/page/sharepoint-designer.aspx

Sharepoint 2013 Tutorial for Beginners

http://www.learningsharepoint.com/2012/12/15/sharepoint-2013-tutorial-for-beginners/

Sharepoint 2013 REST API: The C# Connection: Part 1 Using System.Net.Http.HttpClient

https://dlr2008.wordpress.com/2013/10/31/sharepoint-2013-rest-api-the-c-connection-part-1-using-system-net-http-httpclient/

How to upload and connect files to CRM and SharePoint online

http://www.goisc.com/blog-post/uploading-files-directly-to-sharepoint-and-link-in-crm/

Web Designer Galleries section is missing on SharePoint Online

SharePoint Configuration
http://jsuhail.blogspot.in/2015/05/web-designer-galleries-section-is.html

SharePoint 2013 Server Installation Step By Step Full
https://www.youtube.com/watch?v=u81RqLqWLC8


/***************************************************************************************************/

SQL Server:-

CREATE TABLE IF NOT EXISTS equivalent in SQL Server

http://stackoverflow.com/questions/6520999/create-table-if-not-exists-equivalent-in-sql-server

Dropping and recreating databases in Microsoft SQL Server

http://stackoverflow.com/questions/12364250/dropping-and-recreating-databases-in-microsoft-sql-server
BootStrap:-

CSS

http://getbootstrap.com/css/

Color Library

http://keenthemes.com/preview/metronic/theme/admin_2/ui_colors.html


CSS Only Loaders

https://www.pexels.com/blog/css-only-loaders/

http://jsfiddle.net/zravs3hp/

Chosen 
https://harvesthq.github.io/chosen/

Responsive Sidebar Navigation

http://bootsnipp.com/snippets/featured/responsive-sidebar-navigation

Link to top page

http://bootsnipp.com/snippets/featured/link-to-top-page

W3.CSS Tutorial

http://www.w3schools.com/w3css/default.asp
Theames
http://demo.flatlogic.com/sing-wrapbootstrap-3.3.0/angular/#/app/dashboard

Document Icons

https://icons8.com/web-app/for/all/document
Popup Window Generator
http://dynamicdrive.com/dynamicindex8/popwin.htm

http://xmltocsharp.azurewebsites.net/
/********************************************************************************/


CRM:-

Getting Started with CRM 2011 Online Fetch XML Reporting


https://garethtuckercrm.com/2011/03/24/fetch-xml-reports-for-crm-2011-online/

Creating and working with surveys

https://blogs.technet.microsoft.com/lystavlen/2016/04/05/creating-and-working-with-surveys/

Sample: Create, retrieve, update, and delete (late bound)

https://msdn.microsoft.com/en-us/library/gg328416.aspx

How to display Microsoft CRM records with no recent Activities

http://www.crmsoftwareblog.com/2014/02/how-to-display-microsoft-crm-records-with-no-recent-activities/

mprove user experience by styling and coloring Microsoft Dynamics CRM 2013/2015 Forms on the fly

https://www.codeproject.com/articles/1032318/improve-user-experience-by-styling-and-coloring-mi
microsoft dynamics crm interview questions and answers
http://www.kbstraining.com/blog/microsoft-dynamics-crm-interview-questions-and-answers.htm

Understanding CRM Functional Modules

https://www.tutorialspoint.com/microsoft_crm/microsoft_crm_functional_modules.htm
DYNAMICS CRM Plugin Development Basics
https://www.youtube.com/watch?v=G_WPaHZZk7k

{Bookmarklet} Get current record Guid from CRM form

https://crmdynamicsblog.wordpress.com/2016/06/10/bookmarklet-get-current-record-guid-from-crm-form/comment-page-1/
CRM OnPrem Installation at Virtual machine
https://www.youtube.com/watch?v=OtLcqjnWroA&feature=youtu.be&t=1099

LEARNING MICROSOFT DYNAMICS CRM 2013

https://imlearningdynamicscrm.wordpress.com/2015/03/02/how-to-setup-a-development-environment-for-dynamics-crm-2013-using-vmware-workstation-10/comment-page-1/#comment-7

RIBBON WORKBENCH

http://develop1.net/public/rwb/ribbonworkbench.aspx

Ms. Dynamics CRM

http://missdynamicscrm.blogspot.in/

Learn Easy

https://www.microsoft.com/en-us/dynamics/crm-customer-center/find-your-way-around-dynamics-365-or-dynamics-crm-earlier-versions.aspx

Create templates for email


Microsoft Dynamics CRM - Web Services

Tutoraial

Important Blogs





https://teamtreehouse.com/library/mailchimp-api/mailchimp-api/adding-new-members-to-your-list

READ/CREATE MailChimp Lists and List Members using MailChimp API 3.0

http://yizeng.me/2016/04/23/read-create-mailchimp-lists-and-list-members-using-mailchimp-api-3-0/

/********************************************************************************/

MailChimp :-




MailChimp integration with Microsoft Dynamics CRM 2015

Synchronizing recipients with MailChimp lists


/********************************************************************************/
IONIC:-

Collapsible list items

http://demos.jquerymobile.com/1.4.0/listview-collapsible-item-flat/

RadioButton And CheckBox
https://codepen.io/selfclose/pen/bVyzWX


Placing Phone Calls In Hybrid Apps

https://calendee.com/2015/02/26/placing-phone-calls-in-hybrid-apps/

An Ionic Range example -- RGB color sliders

http://codepen.io/jareilly/pen/KpzjZr
IONIC DATE TIME PICKER
http://codepen.io/anon/pen/WRQZJx

Friday, 2 December 2016

All Important Code


AngularJS: Service vs provider vs factory: -

<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.1/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body >
<div ng-controller="MyCtrl">
    {{hellos}}
</div>
<script>
var myApp = angular.module('myApp', []);

//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
    this.sayHello = function() {
        return "Hello, World!"
    };
});

//factory style, more involved but more sophisticated
myApp.factory('helloWorldFromFactory', function() {
    return {
        sayHello: function() {
            return "Hello, World!"
        }
    };
});
    
//provider style, full blown, configurable version     
myApp.provider('helloWorld', function() {

    this.name = 'Default';

    this.$get = function() {
        var name = this.name;
        return {
            sayHello: function() {
                return "Hello, " + name + "!"
            }
        }
    };

    this.setName = function(name) {
        this.name = name;
    };
});

//hey, we can configure a provider!            
myApp.config(function(helloWorldProvider){
    helloWorldProvider.setName('World');
});
        

function MyCtrl($scope, helloWorld, helloWorldFromFactory, helloWorldFromService) {
    
    $scope.hellos = [
        helloWorld.sayHello(),
        helloWorldFromFactory.sayHello(),
        helloWorldFromService.sayHello()];
}

</script>
</body>
</html>


Loader

HTML

<div class='overlay'><div id='loading-img'></div></div>


JQuery
$(".overlay").show();

$('html, body').css('overflowY', 'auto'); 
 CSS
 
<style>
          #loading-img {
          background: url(http://preloaders.net/preloaders/360/Velocity.gif) center center no-repeat;
          height: 100%;
          z-index: 20;
          }
 
          .overlay {
          background: #e9e9e9;
          display: none;
          position: absolute;
          top: 0;
          right: 0;
          bottom: 0;
          left: 0;
          opacity: 0.5;
          }
        </style>


Allow SSL

 ServicePointManager.Expect100Continue = true;

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

Get using Jquery API

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
   <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>

    <div id="countryname"></div>

</body>
</html>

/********Jquery Code**/
<script>
(function() {
  $.getJSON( flickerAPI, {
    tags: "mount rainier",
    tagmode: "any",
    format: "json"
  })

    .done(function( data ) {
$.each( data.records, function( i, records) {


       var a=  data.records[i].Country;
$('#countryname').append(a+'</br>');
      });
    });
})();
</script>


call angularjs in jQuery



onclick="angular.element(this).scope().methodname()"


Get_Fields_from_CRM


            CrmConnection connection = CrmConnection.Parse(ConfigurationManager.ConnectionStrings["CRMConnectionString"].ConnectionString);
            IOrganizationService service = new OrganizationService(connection);
            OrganizationServiceContext context = new OrganizationServiceContext(service);
            var cases = (from c in context.CreateQuery("account")
                         select c).FirstOrDefault();
            var item = cases.Attributes.Values;


download folders from parature


using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace PratureToAzureDownload_file
{
    class Program
    {
        static void Main(string[] args)
        {
            int AccountId = 7987;
            int DeptId = 8177;
            int CSRId = 14948;
            string token = "a0FUOtXbk9G8d0dLy2HlCtNvm8cwbzSiTIxQ1iYD4eQ@nL1PfWbnk9xdPNwm1Iy0igQfs84HT1eywB/F8J@IVSPkMX6dCNqlhnkil7Ezl0o=";
            string urldata = "https://demo.parature.com/api/v1/";
            //var request = (HttpWebRequest)WebRequest.Create(urldata + AccountId + "/" + DeptId + "/Download?_token_=" + token);
            //request.ContentType = "application/json";
            //var response = (HttpWebResponse)request.GetResponse();
            //if (response.StatusCode == HttpStatusCode.OK)
            //{

            //    var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            //    var dic = XDocument.Parse(responseString).Descendants("Column").ToDictionary(c => c.Attribute("Name").Value, c => c.Value);
            //    var json = new JavaScriptSerializer().Serialize(dic);
            //    var json = JsonConvert.SerializeObject(;

            //}
            //else
            //{
            //    Console.Write("Bad Request");
            //}
            //WebClient c = new WebClient();
            //var data = c.DownloadString(urldata + AccountId + "/" + DeptId + "/Download?_token_=" + token);


            XmlDocument xdoc = new XmlDocument();

            xdoc.Load(urldata + AccountId + "/" + DeptId + "/Download?_token_=" + token);//loading XML in xml doc

            XmlNodeList xNodelst = xdoc.DocumentElement.SelectNodes("Download");
            List<Entities1> entitylst = new List<Entities1>();
            foreach (XmlElement xNode in xNodelst)//traversing XML
            {
                Entities1 entity = new Entities1();

                foreach (XmlNode x in xNode)
                {

                    if (x.Name == "External_Link")
                    {
                        entity.imgUrl = x.InnerText.ToString();
                    }
                    if (x.Name == "Name")
                    {
                        entity.title = x.InnerText.ToString();

                    }
                    if (x.Name == "Ext")
                    {
                        entity.extenson = x.InnerText.ToString();

                    }
                    if (x.Name == "Folders")
                    {
                        entity.Foldername = x.InnerText.ToString();

                    }

                }
                entity.Href = xNode.Attributes["href"].Value.ToString();
                entitylst.Add(entity);
                var a = xNode.Attributes["href"].Value.ToString();
                saveimg(entity.imgUrl, entity.title, entity.extenson, entity.Foldername);
            }

        }


        static void saveimg(string imgurl, string title, string extenson , string foldername)
        {
            string imageUrl = imgurl;

           
            byte[] imageBytes;

            string directorypath = "C:\\pic\\" + foldername;

            if (!Directory.Exists(directorypath))
            {
                Directory.CreateDirectory(directorypath);
            }
            string location = @"C:\pic\"+ foldername+"\\";
            string saveLocation = location + title + "." + extenson;
            if (imageUrl != null)
            {
                if (imageUrl != "")
                {
                    HttpWebRequest imageRequest = (HttpWebRequest)WebRequest.Create(imageUrl);
                    WebResponse imageResponse = imageRequest.GetResponse();

                    Stream responseStream = imageResponse.GetResponseStream();

                    using (BinaryReader br = new BinaryReader(responseStream))
                    {
                        imageBytes = br.ReadBytes(500000);
                        br.Close();
                    }
                    responseStream.Close();
                    imageResponse.Close();

                    FileStream fs = new FileStream(saveLocation, FileMode.Create);
                    BinaryWriter bw = new BinaryWriter(fs);
                    try
                    {
                        bw.Write(imageBytes);
                    }
                    finally
                    {
                        fs.Close();
                        bw.Close();
                    }
                }
            }
        }

      

    }
}

public class Entities1
{
    public string imgUrl { get; set; }
    public string Href { get; set; }
    public string title { get; set; }
    public string extenson { get; set; }
    public string Foldername { get; set; }

}



Plugin For Insert


using System;
using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query;
using System.Collections.Generic;
using Microsoft.Xrm.Sdk.Metadata;
using System.Linq;
using Newtonsoft.Json;
using System.Net;
using System.IO;
using Newtonsoft.Json.Linq;
using System.Runtime.Serialization;


namespace ThinkCrmBlog.DemoPlugin
{
    public class fboNoticeApi : IPlugin
    {

        public string Authtoken = "";
        public static string acessToken;
        public void Execute(IServiceProvider serviceProvider)
        {
            ITracingService tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = factory.CreateOrganizationService(context.UserId);
            tracer.Trace("Into Imtiyaz plugin to call api FBO");

            try
            {
                if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
                {
                    var targetEntity = (Entity)context.InputParameters["Target"];
                    if (targetEntity.LogicalName != "ife_govfbo_notices")
                        return;
                    Entity fboEntity = service.Retrieve("ife_govfbo_notices", targetEntity.Id, new ColumnSet(true));
                    if (fboEntity.Attributes.Contains("ife_token") && fboEntity.Attributes.Contains("ife_href"))
                    {
                        tracer.Trace("Into  FBO token " + fboEntity.Attributes["ife_token"].ToString());
                        tracer.Trace("Into  FBO link " + fboEntity.Attributes["ife_href"].ToString());
                        var ovrelateddoclist = getFBOnotices(fboEntity.Attributes["ife_href"].ToString(), fboEntity.Attributes["ife_token"].ToString(), tracer);
                        EntityReferenceCollection ovrelateddocEntity = new EntityReferenceCollection();
                        Guid FBOguid = new Guid();
                        int i = 0;
                        tracer.Trace("Into  FBO after response " + ovrelateddoclist.Count());
                        foreach (var c in ovrelateddoclist)
                        {
                            i++;
                            try
                            {
                                                               //  fbon["ife_fbonoticesname"] = c.
                               
                                Entity fbon = new Entity("ife_subgovfbonotices");

                                if (c.documentLink != "" && c.documentLink != null)
                                {
                                    fbon["ife_documentlink"] = (c.documentLink);
                                }
                                if (c.id != "" && c.id != null)
                                {
                                    fbon["ife_id"] = c.id;
                                }
                                if (c.publicationDate != "" && c.publicationDate != null)
                                {
                                    fbon["ife_publicationdate"] = (c.publicationDate);
                                }
                                if (c.title != "" && c.title != null)
                                {
                                    fbon["ife_title"] = (c.title);
                                }

                                fbon["ife_name"] = (i.ToString());
                                EntityReference erf = new EntityReference("ife_govfbo_notices", targetEntity.Id);
                                fbon["ife_fbonoticelistid"] = erf;

                                FBOguid = service.Create(fbon);
                                tracer.Trace("Into  FBO after response added");
                                EntityReference CnTr = new EntityReference();
                                CnTr.LogicalName = "ife_subgovfbonotices";
                                CnTr.Id = FBOguid;
                                ovrelateddocEntity.Add(CnTr);
                            }
                            catch (Exception ex)
                            {
                                tracer.Trace("Into  FBO after response added erreor " + ex.Message);
                            }
                        }
                      
                    }

                }
            }
            catch (Exception e)
            {
                throw new InvalidPluginExecutionException(e.Message);
            }
        }

   

        public List<DocumentLinks> getFBOnotices(string url, string token, ITracingService trace)
        {
           

            List<DocumentLinks> GovEntitieslist = new List<DocumentLinks>();
            try
            {
                var request = (HttpWebRequest)WebRequest.Create(url);
                request.Headers["Authorization"] = token;
                request.Method = "GET";
                try
                {
                    WebResponse response = request.GetResponse();

                    using (var streamReader = new StreamReader(response.GetResponseStream()))
                    {
                        var result = streamReader.ReadToEnd();
                        // var json1 = JsonConvert.DeserializeObject<IDictionary<string, RootObjectFBO>>(result);
                        //List<RootObjectFBO> datalist = JsonConvert.DeserializeObject<List<RootObjectFBO>>(result);

                        var json = JsonConvert.DeserializeObject<RootObjectFBO>(result);
                        GovEntitieslist = json.documentLinks;
                    }
                }
                catch (Exception exe)
                { }

            }
            catch (Exception exe)
            {

            }

            return GovEntitieslist;
        }


    }

    //FBO Notices Model

    public class DocumentLinks
    {
        public string documentLink { get; set; }
        public string id { get; set; }
        public string publicationDate { get; set; }
        public string title { get; set; }
    }

    public class RootObjectFBO
    {
        public Links links { get; set; }
        public Meta meta { get; set; }
        public List<DocumentLinks> documentLinks { get; set; }///confusing
    }



}

Send Email code

 public string get(int id)
        {
             
                    SmtpClient MyServer = new SmtpClient();
                    MyServer.Host = "smtp.gmail.com";
                    MyServer.Port = 587;
                    //Server Credentials
                    NetworkCredential NC = new NetworkCredential();
                    NC.UserName = "saddamk206@gmail.com";
                    NC.Password = "saddamk206";
                    //assigned credetial details to server
                    MyServer.Credentials = NC;
                    //create sender address
                    MailAddress from = new MailAddress("saddamk206@gmail.com", "Saddam Khan");
            //create receiver address
            MailAddress receiver = new MailAddress("shussain@moreyeahs.com", "saddam moreyeahs");
                    MailMessage Mymessage = new MailMessage(from, receiver);

                    Mymessage.Subject = "test";

                    //emailTemplate.Replace(mailMessage.ToString(), mailMessage1);
                    //var newbody = mailMessage.ToString() + "</br>Please click the link below to check your appointment:</br>"+ custlink;
                    Mymessage.Body = "this is test msg";
                    Mymessage.IsBodyHtml = true;
                    MyServer.EnableSsl = true;
                    //sends the email
                    MyServer.Send(Mymessage);
            return null;
              
      

    }


crud in MVC

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication2.Models;

namespace MvcApplication2.Controllers
    public class Default1Controller : Controller
    {
        private Prod_BuildTrailEntities db = new Prod_BuildTrailEntities();

        //
        // GET: /Default1/

        public ViewResult Index()
        {
            return View(db.UserProjects.ToList());
        }

        //
        // GET: /Default1/Details/5

        public ViewResult Details(int id)
        {
            UserProject userproject = db.UserProjects.Find(id);
            return View(userproject);
        }

        //
        // GET: /Default1/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /Default1/Create

        [HttpPost]
        public ActionResult Create(UserProject userproject)
        {
            if (ModelState.IsValid)
            {
                db.UserProjects.Add(userproject);
                db.SaveChanges();
                return RedirectToAction("Index");  
            }

            return View(userproject);
        }
        
        //
        // GET: /Default1/Edit/5

        public ActionResult Edit(int id)
        {
            UserProject userproject = db.UserProjects.Find(id);
            return View(userproject);
        }

        //
        // POST: /Default1/Edit/5

        [HttpPost]
        public ActionResult Edit(UserProject userproject)
        {
            if (ModelState.IsValid)
            {
                db.Entry(userproject).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(userproject);
        }

        //
        // GET: /Default1/Delete/5

        public ActionResult Delete(int id)
        {
            UserProject userproject = db.UserProjects.Find(id);
            return View(userproject);
        }

        //
        // POST: /Default1/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {            
            UserProject userproject = db.UserProjects.Find(id);
            db.UserProjects.Remove(userproject);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}


insert from console

static void Main(string[] args)
        {
            SqlConnection con = new SqlConnection();
            con.ConnectionString = @"Data Source=kk7vcq4n1l.database.windows.net; Initial Catalog=Shopkirana;Persist Security Info=True;  Uid=moreyeahs; Password=wfp@ssw0rd;";
            con.Open();
            SqlCommand com = new SqlCommand();
            com.Connection = con;

            com.CommandType = System.Data.CommandType.Text;
            for (int i = 0; i <= 1000; i++)
            {
                string name = "asd" + i;
                string emailid = "a" + i + "@.com";
                string sql = "insert into Customers(Name,Password,Emailid,Active,Deleted,Warehouseid,DivisionId,CompanyId,Cityid,CreatedDate,UpdatedDate,MonthlyTurnOver,Rating,ClusterId) values('" + name + "','12345','" + emailid + "','true','false','5','0','" + i + "','2','07/20/2011 18:03:40','07/20/2011 18:03:40','10000','5','1')";
                com.CommandText = sql;
                var data = com.ExecuteNonQuery();

            }
            con.Close();
        }

crm case


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System.Net;
using System.Xml;
using System.IO;
using System.Xml.Linq;
using System.Threading;
using Microsoft.Xrm.Client;
using Microsoft.Xrm.Client.Services;

namespace consoletry
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Url=https://saddamk206.crm8.dynamics.com; Username=saddamk206@saddamk206.onmicrosoft.com; Password=saddamk_206;";
            CrmConnection connection = CrmConnection.Parse(connectionString);
            OrganizationService organisationservice = new OrganizationService(connection);
            OrganizationServiceContext context = new OrganizationServiceContext(organisationservice);

            var cases = from c in context.CreateQuery("incident")
                        select c;

            var ca = cases.FirstOrDefault();


            string title = ca.GetAttributeValue<string>("title");
            Guid caseId = ca.Id;

            Entity incident = new Entity("incident");
            ColumnSet attributes = new ColumnSet(new string[] { "title", "ownerid" });

            incident = organisationservice.Retrieve("incident", caseId, attributes);

            incident["title"] = "TEst Cases";

            organisationservice.Update(incident);

        }
    }
}


youtube at HTML page

<div class=" col-md-6 col-sm-3 text-center">
<iframe width="100%" height="440" src="https://www.youtube.com/embed/GKWQ30DNWMw" frameborder="0" allowfullscreen style="border-radius: 10px;">
</iframe>
  </div>

Connection String

<add name="doctorDb" connectionString="Data Source=M-DEV-PC-18\SQLEXPRESS;Initial Catalog=doctor_Db;Persist Security Info=True;User ID=sa;Password=sa@123" providerName="System.Data.SqlClient" />

Fetch data from DB in DropDown with selected field

<select class="form-control" id="site-name" ng-model="saveData.CityId" required>
                    <option value="">---SELECT---</option>
                    <option value="{{city.CityId}}" ng-selected="saveData.CityId == city.CityId" ng-repeat="city in Cities"> {{city.CityName}}</option>
                </select>

Angular_Mvc_WebAPI_DataBaseConnectivity

Model---
Class--

    public class city
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public string Country { get; set; }
    }
--------------------------------------------------------------------
DBContext---

  public class CityDbContext:DbContext
    {
        public DbSet<city> city { get; set; }
    }
==================================================================
Controller-----

public IEnumerable<city> Get()
        {
            CityDbContext context = new CityDbContext();
            var _city = from p in context.city.AsEnumerable()
                           select p;
            return _city;
        }
==================================================================
Script-----

var myApp = angular.module('myApp', []);
myApp.controller('MyCtrl', ['$scope', '$http', function ($scope, $http) {
    getCities();
    function getCities() {
        $http({
            method: 'GET',
            url: '/api/cities'
        })
            .success(function (data) {
                if (data != null || data != 'undefined') {
            $scope.cities = data;
        }
            })
}
}]);

===========================================================================


HTML Page-----
<!DOCTYPE html>
<html >
<head>
    <script type="text/javascript"
  src="
http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
        <script src="Scripts/Controller.js"></script>
        <meta charset="utf-8" />
</head>
<body >
    <div  data-ng-app="myApp">
        <div data-ng-controller="MyCtrl">

                           <table>
                             <tr>
                            <th>Id</th>
                                    <th>Name</th>
                                    <th>Country</th>
                        </tr>
                        <tr  data-ng-repeat="city in cities">
                               <td>{{city.Id}}</td>
                          <td>{{city.Name}}</td
                          <td>{{city.Country}}</td>
                               </tr>
                      </table>

</div>
    </div>
</body>
</html>


Angular_Mvc_WebAPI

HLML Page:-
<!DOCTYPE html>
<html>
<head>
    <script src="
http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
    <script src="Scripts/Script.js"></script>
</head>

<body>

<div ng-app="myApp" ng-controller="myCtrl">
    Firstname: <input type="text" ng-model="Firstname" /><br /><br />

    Lastname:  <input type="text" ng-model="Lastname" /><br /><br />

    Fullname: {{Firstname+" "+Lastname }}


    <div ng-repeat="studentList in studentLists">

        Id <input type="text" ng-model="studentList.StudentID" /><br />

        Name <input type="text" ng-model="studentList.StudentName" /><br />

    </div>

</div>


</body>

</html>
------------------------------------------------------------------------------------------------------------------


Controller:-
  public class StudentController : ApiController
    {
        public List<Student> Get()
        {
            Student st = new Student();
            st.StudentID = "1";
            st.StudentName = "John";

            Student st1 = new Student();
            st1.StudentID = "2";
            st1.StudentName = "Tony";


            List<Student> lst = new List<Student>();
            lst.Add(st);
            lst.Add(st1);
            return lst;
        }
    }
----------------------------------------------------------------------------------------------------------
Class:

  public class Student
    {
        public string StudentID { get; set; }
        public string StudentName { get; set; }
    }
--------------------------------------------------------------------------------------------------------------

Script:-
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope, $http) {
    $scope.Firstname = "Sameer";
    $scope.Lastname = "Sharma";

    $http.get('api/Student').then(function (value) {
        console.log(value);
        $scope.studentLists = value.data;
    });
}
);


Packaging and Deploying Web Resources: A Practical ALM Workflow for Dynamics 365 JavaScript

You've written the script. You've unit-tested the logic and stepped through it in dev tools. It works perfectly on your form. Now co...