Esempio n. 1
0
        public ActionResult Post(bool IsNew, BigoteModel varBigote)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IBigoteApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result     = "";
                var BigoteInfo = new Bigote
                {
                    Clave         = varBigote.Clave
                    , Descripcion = varBigote.Descripcion
                };

                result = !IsNew?
                         _IBigoteApiConsumer.Update(BigoteInfo, null, null).Resource.ToString() :
                             _IBigoteApiConsumer.Insert(BigoteInfo, null, null).Resource.ToString();

                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
    private void GenerateCharacters()
    {
        characters = new List <GameObject> ();
        Vector3       aux        = Vector3.right * 6f;
        List <Sprite> spritesAux = chars;
        int           randS;

        for (int i = 0; i < numberOfPeople; i++)
        {
            characters.Add(((GameObject)Instantiate(characterPrefab, aux, Quaternion.identity)));
            randS = Random.Range(0, spritesAux.Count);
            characters [i].GetComponent <SpriteRenderer> ().sprite = spritesAux[randS];
            spritesAux.RemoveAt(randS);

            characters [i].transform.SetParent(parentChar);
            aux += Vector3.right * 6;
            Bigote auxBigote = characters [i].GetComponentInChildren <Bigote> ();
            int    rand      = Random.Range(0, bigotes.Count);
            auxBigote.SetId(rand, bigotes [rand]);
        }
    }
    void OnTriggerEnter2D(Collider2D coll)
    {
        Bigote bigote = coll.GetComponent <Bigote> ();

        if (bigote != null)
        {
            if (controller.GetTimeSinceLastTrigger() > 0.8f)
            {
                if (bigote.GetId() == id)
                {
                    print("Good");
                    controller.CorrectMoustache();
                    controller.ChangeShowPerson();
                }
                else
                {
                    print("Fail");
                    controller.FailMoustache();
                    controller.ChangeShowPerson();
                }
            }
        }
    }
Esempio n. 4
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IBigoteApiConsumer.SetAuthHeader(_tokenManager.Token);

                Bigote varBigote = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IBigoteApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }