Пример #1
0
        public override long?Insert(PetOwner model)
        {
            long?dbId = SimpleCRUD.Insert <long?>(_connection, ToPerson(model));

            if (dbId != null)
            {
                UpdateCache(model, model.Id.ToString());
                return(dbId);
            }
            return(0);
        }
Пример #2
0
        public override long?Insert(PetModel pet)
        {
            long?dbId = SimpleCRUD.Insert <long?>(_connection, ToDbo(pet));

            if (dbId != null)
            {
                UpdateCache(pet, pet.Id.ToString());
                return(dbId);
            }
            return(0);
        }
        /// <summary>
        /// Inserts a row into the database.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public TKey Insert <TKey>(object entityToInsert)
        {
            SetSimpleCRUD();

            TKey ret = default(TKey);

            using (var conn = new SqlConnection(_connectionString))
            {
                conn.Open();
                ret = _simpleCRUD.Insert <TKey>(conn, entityToInsert);
                conn.Close();
            }
            return(ret);
        }
Пример #4
0
        public OperationStatus Insert(Genre genre)
        {
            var opStatus = new OperationStatus {
                Status = true
            };

            try
            {
                SimpleCRUD.Insert <Genre>(Connection, genre);
            }
            catch (System.Exception ex)
            {
                opStatus.Status = false;
                opStatus.ExceptionInnerMessage = ex.Message;
            }

            return(opStatus);
        }
 public virtual TKey Insert <TKey>(TModel entityToInsert, IDbTransaction transaction = null, int?commandTimeout = null)
 {
     return(SimpleCRUD.Insert <TKey, TModel>(_connection, entityToInsert, transaction, commandTimeout));
 }