/// <reference path="modernizr-2.6.2.js" />
/// <reference path="jquery-1.10.2.js" />
/// <reference path="bootstrap.js" />
/// <reference path="respond.js" />
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="ApplicationServices" connectionString="..." providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
</configuration>
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
public class UsersController : System.Web.Http.ApiController
{
[HttpPost]
public void Add(string id, int p1)
{
}
}
internal sealed class Configuration : DbMigrationsConfiguration<Models.ApplicationDbContext>
{
public Configuration()
{
...
ContextKey = "ApplicationDbContextKeyName";
}
var context = new ApplicationDbContext();
var roleStore = new RoleStore<IdentityRole>(context);
var roleMgr = new RoleManager<IdentityRole>(roleStore);
roleMgr.FindByName("Admin").Users - даёт список пользователей.
@using (Html.BeginForm())
{
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
<div class="form-group">
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Сохранить" class="btn btn-primary" />
@Html.ActionLink("Отмена", "Index", null, new { @class="btn btn-default"})
</div>
</div>
</div>
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(AspNetRole model)
{
if (ModelState.IsValid)
{
db.Entry(model).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(model);
}
using System;
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
public class Program
{
public static void Main()
{
var xml = XDocument.Load("test.xml");
xml.XPathSelectElements("//field[@name='Country or Area']").ToList().ForEach(n =>
Console.WriteLine(n.Value)
);
}
}