void ActionResult Index(Options options)
{_options = options }
ActionResult Index(Options options)
, то заведите глобальный статический класс для хранения каких то параметров для всех запросов. Если эти настройки индивидуальны для каждого пользователя, то можно хранить их в сессиях. count.Result
равносильноcount = db.Image.CountAsync().Result
Task.WaitAll(count, notReady);
Вы запустили задачи параллельно, но результат из них так не получите.data = new List<string>();
parts = source.Split("\"");
data.AddRange(parts.Where((x, index) => index % 2 != 0));
data.AddRange(parts.Where((x, index) => index % 2 == 0).Split(","));
result = string.Join(" | ", data.Where(x => !string.IsNullOrWhiteSpace(x));
enemyPool
.Where(e => e.ParentRoomId == 0)
.Take(amount)
.ToList()
.ForEach(e =>
{
e.ParentRoomId = roomId;
e.GameObj.transform.position = spawnPosition.position;
e.GameObj.transform.rotation = spawnPosition.rotation;
e.GameObj.SetActive(true);
});
count = 0;
for(vat i = 0; i < enemyPool.Count; i++)
{
if(enemyPool[i].ParentRoomId == 0)
{
count ++;
if(count >= amount)
break;
enemyPool[i].ParentRoomId = roomId;
enemyPool[i].GameObj.transform.position = spawnPosition.position;
enemyPool[i].GameObj.transform.rotation = spawnPosition.rotation;
enemyPool[i].GameObj.SetActive(true);
}
}
public class RazorTemplateGenerator
{
public void SetupReportTemplating(string baseDirectory = null)
{
var cfg = new TemplateServiceConfiguration
{
Debug = true
};
Engine.Razor = RazorEngineService.Create(cfg);
var folder = Path.Combine(baseDirectory ?? System.AppDomain.CurrentDomain.BaseDirectory, "Pages","PageTemplates");
var templates = Directory.GetFiles(folder, "*.cshtml");
foreach (var fName in templates)
{
var info = new FileInfo(fName);
var tName = Path.GetFileNameWithoutExtension(info.Name);
var template = File.ReadAllText(fName);
var src = new LoadedTemplateSource(template, fName.Replace(@"\bin",String.Empty));
Engine.Razor.AddTemplate(tName, src);
}
}
public void CheckCompile(string name)
{
Engine.Razor.Compile(name);
}
public string RenderPage(string viewName, object model)
{
return Engine.Razor.RunCompile(viewName, model.GetType(), model);
}
}
$.ajax({
type: "POST",
url: window.baseUrl + "Controller/Action",
data: params,
success: function (result) {
if (result) {
$(".modal").html(result);
}
})
public ActionResult Action(IncomingParameters params)
{
var model = Anything(params);
return PartialView("Action", model);
}
var timeout = 600;
var optionsBuilder = new DbContextOptionsBuilder<InstituteContext>()
.UseSqlServer(new SqlConnection(connectionString), opt =>
{
opt.CommandTimeout(timeout);
});
using (var context = new InstituteContext (optionsBuilder.Options))
{
// your code
}