следует отметить, что в C # все арифметические выражения производятся на int. Это означает, что вам нужно будет увеличить число байтов до типа int, чтобы выполнить вычисления на них
var orders = db.Orders
.Where(x => x.Kod == kod)
.GroupBy(x => x.Nomenklatura)
.ToDictionary(x => x.FirstOrDefault().Nomenklatura, x => x.ToList() )
orders["anyNomenklatura"]
$(".show-some").each(function (index, value) { $(this).click(function(){ .... }))
var word = db.Words.Include(x => x.LearnDay).Where(p => p.Id == testId).FirstOrDefault();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace laba3
{
public class Vektor
{
public readonly double x, y, z;
public Vektor(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
//summa
public Vektor Add(Vektor V)
{ return new Vektor(this.x + V.x, this.y + V.y, this.z + V.z); }
//raznost
public Vektor Razn(Vektor V)
{ return new Vektor(this.x - V.x, this.y - V.y, this.z - V.z); }
public double Length()
{ return Math.Sqrt(x * x + y * y + z * z); }
public double Length(Vektor V)
{ return (Math.Sqrt(x * x + y * y + z * z) * Math.Sqrt(x * x + y * y + z * z));}
//skalarnoe proizvedenie
public virtual double Skalar(Vektor V)
{ return x * this.x + y * this.y + z * this.z; }
//umnozenie na skalar a
public double Uskalar()
{
double a = 1;
return a * this.x + a * this.y + a * this.z;
}
//sravnenie
public bool Equals(Vektor V)
{
if (!(V is Vektor))
{ return false; }
return base.Equals(V);
}
public override string ToString()
{
return $"{x} {y} {z}";
}
}
//класс наследник +переопределение
class Naslednik : Vektor
{
public override double Skalar(Vektor V)
{
base.Skalar(V);
return 2*x * this.x + 2*y * this.y + 2*z * this.z; ;
}
}
public class Demo
{
public static void Main()
{
Vektor A = new Vektor(10, 7, 9);
Vektor B = new Vektor(3, 5, 7);
Console.WriteLine("A vektor: x={0},y={1},z={2}", A.x, A.y, A.z);
Console.WriteLine("B vektor: x={0},y={1},z={2}", B.x, B.y, B.z);
Console.WriteLine($"Summa : {A.Add(B)}");
Console.WriteLine($"Raznost: {A.Razn(B)}");
Console.WriteLine($"The scalar *****: {A.Skalar(B)}");
Console.WriteLine("Dlina A : {0} ", A.Length());
Console.WriteLine("Dlina B : {0} ", B.Length());
Console.WriteLine($"Umnozenie na skalar-Vektor A: {A.Uskalar()}");
Console.WriteLine($"Umnozenie na skalar-Vektor B: {B.Uskalar()}");
Console.WriteLine($"Vektor v kvadrate-Vektor A: {A.Length(B)}");
Console.WriteLine($"Ravni li: {A.Equals(B)}");
Console.WriteLine("Press Enter...");
Console.ReadLine(); // Чтобы программа сразу не закрылась
}
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthorization(x =>
{
x.AddPolicy("RoleStartWith", policy => {
policy.RequireRole(roles.Where(r => r.StartsWith("ad")));
});
});
}
[Authorize(Policy = "RoleStartWith")]
public IActionResult Index()
{
return View();
}
public class CustomAutorizeAttribute : AuthorizeAttribute
{
private string _prefix;
private string[] _roles;
public CustomAutorizeAttribute(string prefix)
{
_prefix = prefix;
_roles = base.Roles.Split(',').Select(x => x.Trim()).ToArray();
}
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
return _roles.Where(x => x.StartsWith(_prefix)).Any(x => httpContext.User.IsInRole(x));
}
}
[CustomAutorize(prefix = "ad")]
public IActionResult Index()
{
return View();
}