public ActionResult Index(string huntName, string description)
        {
            Account act = _accountModel.GetAccountByAccountToken(Session["account"].ToString(), Session["account_type"].ToString());
            var hunt = new Hunt()
            {
                Creator = act,
                Name = huntName,
                Description = description
            };
            _huntModel.CreateHunt(act, hunt);

            var comm = new Models.Communications();

            switch (Session["account_type"].ToString())
            {
                case "Facebook":
                    comm.PostToFacebook(huntName, Session["access_token"].ToString());
                    break;
                case "Twitter":
                    comm.PostToTwitter(huntName, Session["access_token"].ToString());
                    break;

            }

            return View();
        }
Exemple #2
0
        public Hunt CreateHunt(Account user, Hunt huntTemplate)
        {
            if ((from hunt in _container.Hunts where hunt.Name == huntTemplate.Name select hunt).FirstOrDefault() != null)
                throw new HuntAlreadyExistsException();

            huntTemplate.Id = Guid.NewGuid();
            _container.AddToHunts(huntTemplate);
            _container.SaveChanges();

            return huntTemplate;
        }
        public static HuntInstance CreateDummyHuntInstance()
        {
            var theObjective = new Objective()
                {
                    Id = new Guid("{81573EBA-C5AA-4423-B308-BCB3026AE771}"),
                    Name = "Find a fountain!",
                    Description = "It must be green.",
                    Score = 100
                };

            var theAdmin = new Account()
                {
                    Id = new Guid("{714DC8D9-42EA-43F2-8148-DDFAC1E585C5}"),
                    Name = "SuperTom"
                };

            var britAccount = new Account()
                {
                    Id = new Guid("{614DC8D9-42EA-43F2-8148-DDFAC1E585C6}"),
                    Name = "Brit"
                };

            var theHunt = new Hunt()
                {
                    Id = new Guid("{741BB781-531D-4354-A840-777E267A809E}"),
                    Name = "DummyHunt",
                    Description = "A dummy hunt!",
                    Creator = theAdmin,

                };

            var theInstance = new HuntInstance()
                {
                    Id = new Guid("{E41BB781-531D-4354-A840-777E267A809E}"),
                    Admin = theAdmin,
                    StartTime = new DateTime(2012, 12, 1, 12, 0, 0, 0),
                    EndTime = new DateTime(2012, 12, 2, 12, 0, 0, 0),
                    Hunt = theHunt
                };

            var britHunter = new Hunter()
                {
                    Id = new Guid("{F41BB781-531D-4354-A840-777E267A809E}"),
                    Account = britAccount,
                    HuntInstance = theInstance
                };

            theInstance.Hunters.Add(britHunter);
            theHunt.Objectives.Add(theObjective);
            theObjective.Hunt = theHunt;

            return theInstance;
        }
Exemple #4
0
 public HuntInstance StartHunt(Account user, Hunt hunt)
 {
     return new HuntInstance();
 }
 /// <summary>
 /// Create a new Hunt object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static Hunt CreateHunt(global::System.Guid id, global::System.String name, global::System.String description)
 {
     Hunt hunt = new Hunt();
     hunt.Id = id;
     hunt.Name = name;
     hunt.Description = description;
     return hunt;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Hunts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHunts(Hunt hunt)
 {
     base.AddObject("Hunts", hunt);
 }