This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Common | |
{ | |
internal static string ReverseString(string input) | |
{ | |
string output = string.Empty; | |
char[] chars = input.ToCharArray(); | |
for (int i = chars.Length - 1; i >= 0; i--) | |
{ | |
output += chars[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using XML_WebGrid_aspnetmvc.Models | |
@model IEnumerable<Customer> | |
@{ | |
ViewBag.Title = "Home Page"; | |
WebGrid webGrid = new WebGrid(source: Model, canPage: true, canSort: true); | |
} | |
<div class="row"> | |
@webGrid.GetHtml( | |
htmlAttributes: new { @id = "WebGrid", @class = "table" }, | |
columns: webGrid.Columns( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
List<Customer> customers = new List<Customer>(); | |
//Load the XML file in XmlDocument. | |
XmlDocument doc = new XmlDocument(); | |
doc.Load(Server.MapPath("~/customer.xml")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer | |
{ | |
public int customerId { get; set; } | |
public string firstName { get; set; } | |
public string lastName { get; set; } | |
public string email { get; set; } | |
public string street { get; set; } | |
public string city { get; set; } | |
public string state { get; set; } | |
public string zipCode { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<CustomerDetails> | |
<customer> | |
<customer_id>1</customer_id> | |
<first_name>Debra</first_name> | |
<last_name>Burks</last_name> | |
<email>debra.burks@yahoo.com</email> | |
<street>9273 Thorne Ave. </street> | |
<city>Orchard Park</city> | |
<state>NY</state> | |
<zip_code>14127</zip_code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IpcServiceClient<ICalculator> client = new IpcServiceClientBuilder<ICalculator>() | |
.UseNamedPipe("pipeName") // or .UseTcp(IPAddress.Loopback, 45684) to invoke using TCP | |
.Build(); | |
int result = await client.InvokeAsync(x => x.Addcalc(12, 15)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// configure DI | |
IServiceCollection services = ConfigureServices(new ServiceCollection()); | |
// build and run service host | |
new IpcServiceHostBuilder(services.BuildServiceProvider()) | |
.AddNamedPipeEndpoint<IComputingService>(name: "endpoint1", pipeName: "pipeName") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculator : ICalculator | |
{ | |
public int AddFloat(int x, int y) | |
{ | |
return x + y; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ICalculator | |
{ | |
int Addcalc(int x, int y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void InsertElement() | |
{ | |
string strQuery = "insert into customers (CustomerID, CompanyName) values (@CustomerID, @CompanyName)"; | |
SqlCommand cmd = new SqlCommand(strQuery); | |
cmd.Parameters.AddWithValue("@CustomerID", "001"); | |
cmd.Parameters.AddWithValue("@CompanyName", "Google"); | |
InsertUpdateData(cmd); | |
Response.Redirect(Request.Url.AbsoluteUri); | |
} |