示例#1
0
        public async Task AddAsync(Entities.Movie entity)
        {
            var ex = await FindAsync(entity.Id);

            if (entity == null)
            {
                throw new ArgumentNullException();
            }
            else if (!ex)
            {
                var query = "movie_save";
                var param = new DynamicParameters();
                param.Add("@Id", entity.Id);
                param.Add("@title", entity.title);
                param.Add("@poster", entity.poster);
                param.Add("@voteAverage", entity.voteAverage);
                param.Add("@videoSource", entity.videoSource);
                param.Add("@isPosted", entity.IsPosted);

                await connection.ExecuteScalarAsync(query, param, commandType : System.Data.CommandType.StoredProcedure, transaction : transaction);
            }
            else
            {
            }
        }
示例#2
0
        public void Remove(Entities.Movie entity)
        {
            string command = "movie_remove";
            var    param   = new DynamicParameters();

            param.Add("@Id", entity.Id);

            connection.Execute(command, param, transaction, commandType: CommandType.StoredProcedure);
        }