public User Validate(string login, string secret)
{
return DbContext.Users.FirstOrDefault(x=>x.login == login && secret == secret );
}
public async void SignIn(User user)
{
List<Claim> claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.Name, user.Name));
ClaimsIdentity identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
ClaimsPrincipal principal = new ClaimsPrincipal(identity);
await HttpContext.Authentication.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);
}
public async void SignOut()
{
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
}
Необходимо ли изучать потоки, асинхронность , XML и прочее?
Необходимо ли полностью изучать с#, JavaScript, Html &CSS ?
public class SampleContainer
{
public string MethodName { get; set; }
public object[] Params { get; set; }
}
<Method>
<Name>Some_Method_Name</Name>
<Params>
<Param name = 'param1' value='value1'></Param>
<Param name = 'param2' value='value2'></Param>
</Params>
</Method>
using System;
using System.Reflection;
namespace ConsoleApplication2
{
public class Sample
{
public string SampleMethod(string param1, string param2)
{
return param1 + param2;
}
}
class Program
{
static void Main(string[] args)
{
Sample sample = new Sample();
var method = typeof(Sample).GetMethod("SampleMethod");
object[] param = new object[] {"Hello ","World!"};
string result = method.Invoke(sample, param) as string;
Console.WriteLine(result);
Console.ReadKey();
}
}
}