Exemple #1
0
        public BSet Create(BSet value)
        {
            string query = @"
     INSERT INTO bsets (title, descr)
          VALUES(@Title, @Description)";
            int    id    = _db.ExecuteScalar <int>(query, value);

            value.Id = id;
            return(value);
        }
Exemple #2
0
        public BSet GetById(int id)
        {
            string query = "SELECT * FROM bsets WHERE id = @id";
            BSet   bset  = _db.QueryFirstOrDefault <BSet>(query, new { id });

            if (bset is null)
            {
                throw new Exception("Invalid Id");
            }
            return(bset);
        }
Exemple #3
0
        public BSet Update(BSet value)
        {
            string query = @"
      UPDATE bset
      SET   
         title = @Title
      WHERE id = @Id;

      SELECT * FROM bsets WHERE id = @Id";

            return(_db.QueryFirstOrDefault <BSet>(query, value));
        }