public async Task AddFatty(Fatty fatty)
        {
            var spName = "public.add_fatty";
            var query  = await _connection.QueryAsync <int>(
                spName,
                new
            {
                name          = fatty.UserInfo.Name,
                surname       = fatty.UserInfo.Surname,
                password      = fatty.UserInfo.Password,
                email         = fatty.UserInfo.Email,
                birthday      = fatty.UserInfo.Birthday,
                sex           = (short)fatty.UserInfo.Sex,
                hidefoodtrach = fatty.HideFoodTrack,
                hideage       = fatty.HideAge,
                hideemail     = fatty.HideEmail,
                currentweight = fatty.CurrentWeigth,
                desiredweight = fatty.DesiredWeigth,
                heigth        = fatty.Heigth,
                trainer_id    = 0
            },
                commandType : CommandType.StoredProcedure
                );

            fatty.Id = query.Single();
        }
Esempio n. 2
0
        public async Task <Fatty> AddFattyAsync(UserInfo userInfo,
                                                bool hideFoodTrack,
                                                bool hideAge,
                                                bool hideEmail,
                                                double currentWeigth,
                                                double desiredWeigth,
                                                double height,
                                                int?trainerId = null)
        {
            var maybeExistFatty = await _fattyRepository.GetByEmail(userInfo.Email);

            if (maybeExistFatty != null)
            {
                throw new InvalidOperationException("Fatty with this email already exist");
            }

            var newFatty = new Fatty(
                userInfo,
                hideFoodTrack,
                hideAge,
                hideEmail,
                currentWeigth,
                desiredWeigth,
                height,
                null
                );

            await _fattyRepository.AddFatty(newFatty);

            return(newFatty);
        }
Esempio n. 3
0
        private async void Fatty_Tapped(object sender, EventArgs e)
        {
            Skinny.Border.Color  = Color.FromHex("#f1f1f1");
            Average.Border.Color = Color.FromHex("#f1f1f1");
            await Fatty.ScaleTo(0.85);

            Fatty.Border.Color = Color.LightGray;
            await Fatty.ScaleTo(1);
        }
        private async void Fatty_Tapped(object sender, EventArgs e)
        {
            Skinny.BackgroundColor  = Color.FromHex("#1D212C");
            Skinny.Border.Color     = Color.FromHex("#33394a");
            Average.BackgroundColor = Color.FromHex("#1D212C");
            Average.Border.Color    = Color.FromHex("#33394a");
            await Fatty.ScaleTo(0.85);

            Fatty.BackgroundColor = Color.FromHex("#6d54f8");
            await Fatty.ScaleTo(1);
        }
Esempio n. 5
0
        private async Task <ClaimsIdentity> GetIdentityAsync(string email, string password)
        {
            Fatty person = await _fattyRepo.GetByEmail(email);

            if (person != null && person.UserInfo.Password == password)
            {
                var claims = new List <Claim>
                {
                    new Claim(ClaimsIdentity.DefaultNameClaimType, person.UserInfo.Email),
                    new Claim(ClaimsIdentity.DefaultRoleClaimType, "Fatty"),
                    new Claim("UserId", person.Id.ToString())
                };
                ClaimsIdentity claimsIdentity =
                    new ClaimsIdentity(claims, "Token", ClaimsIdentity.DefaultNameClaimType,
                                       ClaimsIdentity.DefaultRoleClaimType);
                return(claimsIdentity);
            }
            return(null);
        }
Esempio n. 6
0
    void Start()
    {
        hurtPanel = GameObject.FindGameObjectWithTag("HurtPanel").GetComponent <HurtPanel>();
        shake     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>();
        gm        = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
        if (isFatty == true)
        {
            fatty = GetComponent <Fatty>();
        }

        if (isCarrier == true)
        {
            carrier = GetComponent <FireCarrier>();
        }

        if (isBomber == true)
        {
            bombed = GetComponent <Bombed>();
        }
    }
        public async Task <Fatty> GetById(int id)
        {
            var spName = "public.get_fatty_by_id";
            var query  = await _connection.QueryAsync <FattyDataFromDbDTO>(
                spName,
                new
            {
                fatty_id = id
            },
                commandType : CommandType.StoredProcedure
                );

            var dto = query.SingleOrDefault();

            if (dto == null)
            {
                return(null);
            }
            var userInfo = new UserInfo(dto.name, dto.surname, dto.password, dto.email, dto.birthday, (Sex)dto.sex);
            var fatty    = new Fatty(userInfo, dto.hidefoodtrach, dto.hideage, dto.hideemail, dto.currentweight, dto.desiredweight, dto.heigth, null);

            fatty.Id = dto.id;
            return(fatty);
        }