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));
        }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     taskManager  = GameObject.FindWithTag("GameManager").GetComponent <TaskManager>();
     anim         = GetComponent <WorkerAnimationManager>();
     delivery     = GetComponent <DeliveryTask>();
     construction = GetComponent <ConstructionTask>();
     hasTask      = false;
 }
예제 #3
0
 public async Task CreateConstructionTask(ConstructionTask task)
 {
     using (ApplicationDbContext context = new ApplicationDbContext())
     {
         task.Id = Guid.NewGuid();
         context.ConstructionTask.Add(task);
         await context.SaveChangesAsync();
     }
 }
예제 #4
0
파일: Build.cs 프로젝트: Geertien/BoreasSc2
 public virtual void InitializeTasks()
 {
     IdleTask.Enable();
     ProductionTask.Enable();
     WorkerTask.Enable();
     ConstructionTask.Enable();
     MorphingTask.Enable();
     WorkerDefenseTask.Enable();
 }
예제 #5
0
 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();
 }
예제 #6
0
 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();
         }
     }
 }