Beispiel #1
0
        public DbUpload Insert(DbUpload upload)
        {
            Command cmd = new Command("INSERT INTO Upload (Context, UserId, CategoryId, [File],  RatingTypeId, Anonymous) OUTPUT inserted.* VALUES (@context, @userid, @categoryid, CONVERT(VARBINARY(MAX), @file),  @ratingtypeid, @anonymous)");

            cmd.SetParameters(upload);
            return(_connection.ExecuteReader(cmd, UniversalDbToEntityMapper.Mapper <DbUpload>).FirstOrDefault());
        }
Beispiel #2
0
        public DbUpload Update(DbUpload upload)
        {
            Command cmd = new Command("UPDATE Upload OUTPUT inserted.* SET Context = @context, CategoryId = @categoryid, [File] = @file, LimitDate = @limitdate, Anonymous = @anonymous, Active = @active WHERE Id = @id");

            cmd.SetParameters(upload);
            return(_connection.ExecuteReader(cmd, UniversalDbToEntityMapper.Mapper <DbUpload>).FirstOrDefault());
        }