public async Task <ActionResult> Create(ConstructionTask constructionTask) { if (ModelState.IsValid) { try { await _task.CreateConstructionTask(constructionTask); return(RedirectToAction("IndexAdminTask")); } catch { return(RedirectToAction("BadRequest", "Home")); } } if (constructionTask.WorkerTypeId == null) { ViewBag.Worker = new SelectList(await _task.GetWorkerTypes(), "Id", "Type"); } else { ViewBag.Worker = new SelectList(await _task.GetWorkerTypes(), "Id", "Type", constructionTask.WorkerTypeId); } return(View(constructionTask)); }
// Use this for initialization void Start() { taskManager = GameObject.FindWithTag("GameManager").GetComponent <TaskManager>(); anim = GetComponent <WorkerAnimationManager>(); delivery = GetComponent <DeliveryTask>(); construction = GetComponent <ConstructionTask>(); hasTask = false; }
public async Task CreateConstructionTask(ConstructionTask task) { using (ApplicationDbContext context = new ApplicationDbContext()) { task.Id = Guid.NewGuid(); context.ConstructionTask.Add(task); await context.SaveChangesAsync(); } }
public virtual void InitializeTasks() { IdleTask.Enable(); ProductionTask.Enable(); WorkerTask.Enable(); ConstructionTask.Enable(); MorphingTask.Enable(); WorkerDefenseTask.Enable(); }
public virtual void InitializeTasks() { IdleTask.Enable(); ProductionTask.Enable(); WorkerTask.Enable(); ConstructionTask.Enable(); MorphingTask.Enable(); WorkerDefenseTask.Enable(); if (Tyr.Bot.MyRace == Race.Terran) { ConstructingSCVsTask.Enable(); } GasWorkerTask.Enable(); }
public async Task EditConstructionTask(ConstructionTask task) { using (ApplicationDbContext context = new ApplicationDbContext()) { var update = context.ConstructionTask.Find(task.Id); if (update != null) { update.TaskName = task.TaskName; update.TaskDescription = task.TaskDescription; update.RatePerHour = task.RatePerHour; update.WorkerTypeId = task.WorkerTypeId; update.IsDeleted = task.IsDeleted; await context.SaveChangesAsync(); } } }