Talent without working hard is nothing.
by

The concept of function within a function, like we normally do inside a class.

We will create a method GetName() .

The code will look like the following.

static void Main(string[] args)  {     Console.WriteLine("Name is: " + GetName());  }  public static string GetName()  {    return "Name";  }  

Next, we need to add more , will create Function called GetFullName() , will call 2 methods GetFName() and GetLName. 

This result will be added to the GetFullName() and the complete result will be returned.

 

The main point here is that if we create a public method to concate our string togather, it will be globally available. If we create a private method, the method will be available to other methods as well, which is not required. So, what we will do is create the method as a sub-method within the GetFullName function. This will be created like any other normal function. So, the code will look like the following.

namespace ConsoleApplication1  {      class Program      {          static void Main(string[] args)          {              Console.WriteLine("Full Name is: " + GetFullName());          }          public static string GetFullName()          {              var FullName= GetFName() + " " +GetLName();                return FullName;                          string GetFName()              {                  return "First Name";              }              string GetLName()              {                  return "Last Name";              }          }      }  

 we have created another two methods GetFName() and  GetLName() within a function to return FullName(). 

 

 

Read more..
On
by

Database initialize class

???? ?? ???? ?????? ????? ???????? ?? ?????? ?????? .

??? ?? ????? ?????? :

 

Repository class implementation

 

?????? ??????? ????? ???? ?????? ??????? ?? ???? ?????????? repository class , ????? ????? ??????? ??? ????? ???????? ??????? LINQ ??? Entity  .

?????? BloodDonorRepository  , ???? ?? ???? ??? ???? ?????? ??  IBloodDonorRepository interface

 

?????? ??????? ?? ?????????? , ??? ?????? LINQ to Entity  ?? ??? ???????? ?? ????? ???????? , ??? ???? ?????? ?????

a blood donor

 

  1. Create object of context class
  2. Use context.entiy.Add(entity)
  3. Use context.SaveChnages()

 

 

???? ?????? ????? ??? ????? ???? ?????????? ????????? ?? ??????? , ????? ??? ??? ????? ??? Build  ??????? , ??????? ?? ????? ????? .

 

Web Project 


??? ???? ?????? ????? MVC  , ???? ????? ??????? ?? ???????? ??????? Core and Interface  , ?? ?????? ??????? ??????? ??? ?????? .

  1. infrastructure project
  2. core project
  3. Entity Framework package

 

??? ????? ?? ??????? , ?? ???? Build ????? ?? ?? ?? ?? ???? .

?? ??????  New Controller  ?? Entity Framework  .??? ?????? ??????  BloodDonorsController  .

????? ????? ?????? ???????? ??????? :

  1. BloodDonor class from the core project as the Model class
  2. BloodDonorContext class as the data context class from the Infrastructure project

Read more..
On
by

AngularJS is a client-side JavaScript framework developed by Google and the community for developing single-page applications that only require CSS, HTML and JavaScript on the client side.

Features

  • Directives
  • Data Binding
  • Filters
  • Modules
  • Routes
  • Controllers

AngularJS Directives

AngularJS Directives are commands that allow the developer to specify custom and reusable HTML tags that moderate the behavior of certain elements as in the following:

  • ng-app: It will load the dependencies and the module.
  • ng-bind: Automatically changes the text of an HTML element to the value of a given expression.
  • ng-model: Similar to ng-bind, but allows two-way data binding between the view and the scope.
  • ng-class: Allows class attributes to be dynamically loaded.
  • ng-controller: Specifies a JavaScript controller class that evaluates HTML expressions.
  • ng-repeat: Angular control structure act as for loop.
  • ng-click: Angular on click event

Install: Open the website angularjs.

 

Download

Now select Branch and build if you want to uncompress or Zip. And click Download. 

Getting Started

  • Start Visual Studio
  • Create a new website
  • Provide the name and location of website
  • Click "Next"

Add angular.min.js to the scripts directory.

Now let's work on the view part.

To begin let's see how to do data binding using AngularJS:

First of all add a new HTML page and provide a relevant name, now add a angularjs reference to the page.

<script src="Scripts/angular.min.js"></script>

Now add the ng-app directive on the top root of the page or in any div like this.

<html ng-app=""><div class="container" ng-app="">Let's<div class="container" ng-app="">        <h3>AngularJS Data Binding Template </h3>               Name: <input type="text" ng-model="name" placeholder="Type something" />&nbsp;&nbsp; {{ name }}        <br />        Country: <input type="text" data-ng-model="country" placeholder="Type something" />&nbsp;&nbsp; {{ country }}</div>

One more example that calculates 2 numbers:

<div>        <h3>AngularJS Data Binding Template</h3>        <input type="number" ng-model="FirstValue" value="0" placeholder="Enter First value here">        +        <input type="number" ng-model="SecondValue" placeholder="Enter Second value here">        ={{FirstValue+SecondValue}}</div><script src="Scripts/angular.min.js"></script>

Output

 

 

Source :csharpcorner,AngularJS

Read more..
On
by

Core project

 

 

?????? ???????? , ?? ?????? ?????? ?? ???? ??????? , ?? ??????? ???? ??? ??? ?????? Web layer , Infrastructure layer , ????? ??? ??? ?????? .

 

 

?? ????? ?? ?????? ???????? core  ?? ???? ??? ?? ???? ???? .

?????? ?? ????? Core layer  ??? ?????? :

???? ???????? (Domain Entities)

?????? ?????????? ??????? (Repositories interfaces)

??? ?? ?? ???? ?? ?????? ??? ????? ?????? , ??? :

Reference of the ORM like LINQ to SQL or EF

  1. ORM like LINQ to SQL or EF
  2. ADO.NET libraries
  3. Entity Framework .

Create Entity

?????? , Entity  ????? ?????? BloodDonor entity class. .

 

?? ???? ????? ??? ?????? , ????? ????? , ??? ??? ???????? ??????? ?? ??? , ?? ???? ?????? ???? ?????? , ?????? ?? ???????  .

????? ???????? ??????? , ???? ??? ?? ????? ???? :

  1. System.ComponentModel.DataAnnotations
  2. Entity Framework fluent API.

??? ????????? ???????? , ???? ?????? . ?? ??? ???? ?????? ???????? ???? ?? ????? ?????? ??? EntityFramework , ??? ???? ??????? DataAnnotations  .

???????? DataAnnotations  ?? ?????? ?????? ?????? , ??? ????? .

System.ComponentModel.DataAnnotations

 

??? ????? BloodDonor entity class ?? DataAnnotations  .

?????? ??????? ????? ?????? ???????? ??????? repository interface

Repository interface

??? ???? ????? ?????????? repository  ,   ??? ?????????? ???? ?? ??????? ???? ?????? ?????? ???????? ??? ??????? ??? ?? ???? ???? .

?? ?????? ?????????? repository interface , ??? ??? ????? ?? ?????? ????? ???????? ???? ??????? .

 

??? ???????? ?? ????? ?? ??????? ?????????? ?? ?????? ,?????? ??????? ????? ???? ??????? infrastructure project .

Infrastructure project

 

?? ????? ?????? ??????? ,??? ???? ????? ???????? ???????? ???? ???????.

  1. Database operation
  2. Accessing outside service
  3. Accessing File systems

 

?????? ?? ???? ???????? ??????? ???? ?? ????? ?????? ???????. ??? ??????  Entity Framework ?????? ?????? ????? ????????. ??? ???? ??  Entity Framework code first .

 ???? ??? ????? ?????? ??????? ???????:

  1. Create the data context class
  2. Implement the repository class
  3. Create the database initializer class

??? ????? data context class , ??? ????? ???? Entity Framework , ?? Nuget Package Manager .

DataContext class
 

????? ?????? Data context class  .

 

Connection string

< connectionStrings >< add name = "BloodDonorContextConnectionString" connectionString = "Data Source= LocalDb)\v11.0;Initial Catalog=BloodDonors;Integrated Security=True;MultipleActiveResultSets=true" providerName = "System.Data.SqlClient" / >< /connectionStrings>

 

???? ......

 

Source:c-sharpcorner,debugmode

Read more..
On
by

Onion Architecture in ASP.Net MVC

 

???? Onion Architecture ?

?? ??????? ??????? ??  ????? ????????? ?????? ?????? ????????? ???????? ?????????? ?? ????? ??????? ??? ????? ???????? ????????.  ?? ??????? ??? ??????? ???? ??? ?? ??? Jeffery Palermo ?? ?????? ?? ??? 2008

 

????? Onion Architecture

- ?? Onion Architecture  ??????? ????? ?????? ????? ??????? ???????? (Interface) .

- ?? ?????? ??? ??????? ???????? ??? ?????? ??? ????? ???????? ? Web Service  ????? ?? ??? ?? ??????? ????????.

- ???? ??????? ?? ???? ???????? ?? ???? UI  ?? ??? ?? ??????? ???????? .

- ??????? (Obj) ???? ???? ?????? ?? ??? ?? ??????? ????????.

- ???? ??????? ???????? ?? ????? ??? ????? ???????? ?? ???????? ??? .

- ?? ????? ?? ????? ??? ???? ?????? ??? ??????? ????????.

- ?????? (domain object)???? ?? ?????? ?? ?????? , ??????  ?????? ??? ?? ?? ????? ???????? ?????? ????? ????????.

- ?? ???????? ??? ?? ???? ??? ?????? ???????? , ?? ?????? ??????? ??????? ?? ????? ??? ??????? ???????? .

- ?? ??????? ?? ???? ???? ????? ??? ????? ??????? ???????? .

 

???? ???????

 

????? ?? ????? ???? ??????? . ??? ???? ?? ???????? ??????? ??????? :

  1. Core project (Class library)
  2. Infrastructure project (Class library)
  3. Web project (MVC project)

 

 Core Project

 ?????? ??? ?????? (domain entities) ????????? (repositories interfaces) .

Infrastructure project

???? ??????? ??? ????? ??? ?????? ???? ?? ??????? ???????? .

Web project

?????? ???????? ??? ????? ??? MVC Controllers  ?HTML  .

???? ??????? ??? ?? ???? ??? ????? ?????? :

???? ........

 

Source:c-sharpcorner,debugmode

Read more..
On