示例#1
0
        /// <summary>
        /// Invoke api method
        /// </summary>
        /// <param name="model">Model with information</param>
        /// <param name="transactionType">DatatyTransactinon</param>
        public async Task <IActionResult> ExecuteTransaction(JobBoard model, TransactionType transactionType)
        {
            var request = new BusinessValue <JobBoard>();

            switch (transactionType)
            {
            case TransactionType.Add:
                request = await _helper.PostAsync("JobBoard", model);

                break;

            case TransactionType.Edit:
                request = await _helper.PutAsync($"JobBoard/{model.Id}", model);

                break;

            case TransactionType.Delete:
                request = await _helper.DeleteAsync <JobBoard>($"JobBoard/{model.Id}");

                break;
            }
            if (request.Status.Equals(Status.OK))
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(null);//Here we can show error view
            }
        }
示例#2
0
    public void Start()
    {
        // Get references to all assets.
        _assets = FindObjectOfType <AssetLoader>();

        // Add a new job board to the star system
        jobBoard = gameObject.AddComponent <JobBoard> ();

        // Create a company. This will be done elsewhere once procedural company generation is set up.
        transportCompany  = Instantiate(companyTemplate).GetComponent <Company>();
        productionCompany = Instantiate(companyTemplate).GetComponent <Company>();

        // Get a random name for the start
        name = _starNames[Random.Range(0, _starNames.Length)];

        // Generate a random number to be the number of planets we have in the system
        int numOfPlanets = Random.Range(planetSpawnMin, planetSpawnMax);

        // Generate planets and moons
        for (int i = 0; i < Random.Range(planetSpawnMin, planetSpawnMax); i++)
        {
            SpawnPlanet(i, numOfPlanets);
        }

        // Spawn some ships
        for (int i = 0; i < numOfShips; i++)
        {
            SpawnShip();
        }

        // Give the star a sprite
        GetComponent <SpriteRenderer>().sprite = _assets.starSprites["star_blue01"];

        _infoPanel = GameObject.FindGameObjectWithTag("Infopanel");
    }
示例#3
0
        public ActionResult Index(string newJobTitle, string newCompanyName, string newDescription, string newContactName, string newContactEmail, string newContactPhone)
        {
            JobBoard newJob = new JobBoard(newJobTitle, newCompanyName, newDescription, newCompanyName, newContactEmail, newContactPhone);

            List <JobBoard> allItems = JobBoard.GetAll();

            return(View(allItems));
        }
示例#4
0
 public StepsDefinitions(IWebDriver driver)
 {
     _homePage   = new HomePage(driver);
     _jobBoard   = new JobBoard(driver);
     _searchJobs = new SearchJobs(driver);
     _signIn     = new SignInPopup(driver);
     _appForm    = new ApplicationForm(driver);
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            JobBoard jobBoard = await db.JobBoards.FindAsync(id);

            db.JobBoards.Remove(jobBoard);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,job,job_title,description,created_at,expires_at")] JobBoard jobBoard)
        {
            if (ModelState.IsValid)
            {
                db.Entry(jobBoard).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(jobBoard));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,job,job_title,description,created_at,expires_at")] JobBoard jobBoard)
        {
            if (ModelState.IsValid)
            {
                db.JobBoards.Add(jobBoard);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(jobBoard));
        }
        public async Task <BusinessValue <JobBoard> > AddAsync(JobBoard model)
        {
            model.CreatedAt = DateTime.Now;
            await _unitOfWork.JobBoard.AddAsync(model);

            int affectedRows = await _unitOfWork.Complete();

            if (affectedRows == 0)
            {
                return(new BusinessValue <JobBoard>("An error occurred while adding the record", Status.ERROR));
            }
            return(new BusinessValue <JobBoard>(model, "Succesful transaction.", Status.OK));
        }
示例#9
0
        /// <summary>
        /// Show view with information in case edit or empty if it is a new record
        /// </summary>
        /// <param name="id">record id</param>
        /// <returns></returns>
        public async Task <IActionResult> Form(int id = 0)
        {
            ViewData["Action"] = "Add";
            var model = new JobBoard();

            if (id > 0)
            {
                var request = await _helper.GetSingleAsync <JobBoard>($"JobBoard/{id}");

                model = request.Data;
                ViewData["Action"] = "Edit";
            }
            return(View(model));
        }
示例#10
0
        // GET: JobBoards/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobBoard jobBoard = await db.JobBoards.FindAsync(id);

            if (jobBoard == null)
            {
                return(HttpNotFound());
            }
            return(View(jobBoard));
        }
示例#11
0
 /// <summary>
 /// This function returns the job board by the id
 /// </summary>
 /// <param name="jobBoardId"></param>
 /// <returns></returns>
 public JobBoard GetJobBoard(int jobBoardId)
 {
     var jBoard = new JobBoard();
     var context = new dbDataContext();
     // get the job board for the given id
     var jBords = (from t in context.tbl_JobBoards
                   where t.JobBoardId == jobBoardId
                   select new JobBoard
                       {
                           JobBoardId = t.JobBoardId,
                           Title = t.Title,
                           CreditsPerJob = t.CreditsPerJob,
                           IsTopJobBoard = t.IsTopJobBoard,
                           TotalCredits = t.TotalCredits,
                           PricePerJob = t.PricePerJob,
                       }).FirstOrDefault();
     return jBoard;
 }
        public async Task <BusinessValue <JobBoard> > Update(int id, JobBoard model)
        {
            model.Id = id;
            var entity = await _unitOfWork.JobBoard.FindByIdAsync(id);

            if (entity == null)
            {
                return(new BusinessValue <JobBoard>("JobBoard not found", Status.NOT_FOUND));
            }
            _unitOfWork.JobBoard.Update(model);
            int affectedRows = await _unitOfWork.Complete();

            if (affectedRows == 0)
            {
                return(new BusinessValue <JobBoard>("An error occurred while updating the record", Status.ERROR));
            }
            return(new BusinessValue <JobBoard>(model, "Succesful transaction.", Status.OK));
        }
示例#13
0
        public void GetId_ItemsInstantiateWithAnIdAndGetterReturns_Int()
        {
            //Arrange
            string   jobTitle    = "Poozer";
            string   companyName = "Company";
            string   jobDes      = "This job sucks";
            string   Contact     = "Jeff";
            string   Email       = "Email";
            string   Phone       = "phone";
            JobBoard newJobBoard = new JobBoard(jobTitle, companyName, jobDes, Contact, Email, Phone);

            //Act
            int result = newJobBoard.Id;

            System.Console.WriteLine(newJobBoard.Id);

            //Assert
            Assert.AreEqual(1, result);
        }
示例#14
0
 /// <summary>
 /// This function addupdate the job board
 /// </summary>
 /// <param name="jBoard"></param>
 /// <returns></returns>
 public int AddUpdateJobBoard(JobBoard jBoard)
 {
     return -1;
 }
示例#15
0
        public ActionResult SeeListings()
        {
            List <JobBoard> allItems = JobBoard.GetAll();

            return(View(allItems));
        }
 public FreightContract(Employee contractCreator, Company issuingCompany, ResourceReservation reservedResource, JobBoard board)
 {
     issuer        = issuingCompany;
     creator       = contractCreator;
     reservation   = reservedResource;
     base.jobBoard = board;
 }
示例#17
0
 public ActionResult DeleteAll()
 {
     JobBoard.ClearAll();
     return(View());
 }
示例#18
0
 public IActionResult Edit(JobBoard model)
 {
     _repoWrapper.JobBoard.Update(model);
     _repoWrapper.Save();
     return(RedirectToAction("Index"));
 }
示例#19
0
 public async Task <ActionResult <JobBoard> > PostAsync(JobBoard model) => Result(await _blJobBoard.AddAsync(model));
示例#20
0
 public async Task <ActionResult> Put(int id, JobBoard model) => Result(await _blJobBoard.Update(id, model));