Esempio n. 1
0
        public int Add(Practice p)
        {
            SqlParameter[] parameter =
            {
                new SqlParameter("@Username",  p.Username),
                new SqlParameter("@Fullname",  p.Fullname),
                new SqlParameter("@Password",  p.Password),
                new SqlParameter("@CountryID", p.CountryID),
                new SqlParameter("@Gender",    p.Gender),
                new SqlParameter("@Interests", p.Interests)
            };
            string query = "Insert into tblInfo values(@Fullname,@Username,@Password,@CountryID,@Gender,@Interests)";
            var    args  = new DynamicParameters(new { });

            parameter.ToList().ForEach(t => args.Add(t.ParameterName, t.Value));
            var add = this._db.Execute(query, args);

            return(add);
        }
Esempio n. 2
0
        public int Update(Practice p)
        {
            SqlParameter[] parameter =
            {
                new SqlParameter("@Username",  p.Username),
                new SqlParameter("@Fullname",  p.Fullname),
                new SqlParameter("@Password",  p.Password),
                new SqlParameter("@Gender",    p.Gender),
                new SqlParameter("@CountryID", p.CountryID),
                new SqlParameter("@Interests", p.Interests),
                new SqlParameter("@ID",        p.ID)
            };
            string query = ("Update tblInfo set Username=@Username,Fullname=@Fullname,Password=@Password,Gender=@Gender,CountryID=@CountryID,Interests=@Interests Where ID=@ID");
            var    args  = new DynamicParameters(new { });

            parameter.ToList().ForEach(t => args.Add(t.ParameterName, t.Value));
            var update = this._db.Execute(query, args);

            return(update);
        }